Migrate jest to vitest

This commit is contained in:
Alex Miller 2024-09-11 12:33:39 +12:00
parent 9a1e626831
commit 6818e25de3
9 changed files with 713 additions and 1984 deletions

View File

@ -1,5 +1,5 @@
{
"plugins": ["jest", "@typescript-eslint"],
"plugins": ["@typescript-eslint"],
"extends": ["plugin:github/internal"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
@ -47,7 +47,6 @@
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
"es6": true
}
}
}

35
.vscode/launch.json vendored
View File

@ -1,35 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest All",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["--runInBand"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
},
{
"type": "node",
"request": "launch",
"name": "Jest Current File",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--config",
"jest.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"windows": {
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
}
}
]
}

View File

@ -1,3 +1,5 @@
import {describe, expect, test} from 'vitest'
import {csvEscape} from '../src/list-format/csv-escape'
describe('csvEscape() backslash escapes every character except subset of definitely safe characters', () => {

View File

@ -1,3 +1,5 @@
import {describe, expect, test} from 'vitest'
import {Filter} from '../src/filter'
import {File, ChangeStatus} from '../src/file'

View File

@ -1,3 +1,5 @@
import {describe, expect, test} from 'vitest'
import * as git from '../src/git'
import {ChangeStatus} from '../src/file'

View File

@ -1,3 +1,5 @@
import {describe, expect, test} from 'vitest'
import {backslashEscape, shellEscape} from '../src/list-format/shell-escape'
describe('escape() backslash escapes every character except subset of definitely safe characters', () => {

View File

@ -1,11 +0,0 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}

View File

@ -11,7 +11,7 @@
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"pack": "ncc build -m",
"test": "jest",
"test": "vitest",
"all": "pnpm run build && pnpm run format && pnpm run lint && pnpm run pack && pnpm test"
},
"repository": {
@ -35,7 +35,6 @@
"devDependencies": {
"@octokit/webhooks-types": "^7.3.1",
"@tsconfig/node20": "^20.1.2",
"@types/jest": "^29.5.11",
"@types/js-yaml": "^4.0.9",
"@types/micromatch": "^4.0.2",
"@types/node": "^20.0.0",
@ -44,12 +43,9 @@
"@vercel/ncc": "^0.38.1",
"eslint": "^8.56.0",
"eslint-plugin-github": "^4.10.1",
"eslint-plugin-jest": "^27.6.3",
"jest": "^29.7.0",
"jest-circus": "^29.7.0",
"prettier": "^3.2.4",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"vitest": "^2.0.5"
},
"volta": {
"node": "20.17.0",

File diff suppressed because it is too large Load Diff