Skip to content

Commit 81842a8

Browse files
committed
chore(test): Migrate to vitest
1 parent 07e3f09 commit 81842a8

22 files changed

+976
-2534
lines changed

.github/workflows/ci.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ jobs:
116116
run: pnpm install
117117

118118
- name: Check Tests
119-
run: pnpm test:js:coverage
120-
121-
- name: Build
122-
run: pnpm build
119+
run: pnpm test:coverage
123120

124121
- name: Upload coverage to Codecov
125122
uses: codecov/codecov-action@v4

.github/workflows/codecov_test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: pnpm build
3636

3737
- name: Check Tests
38-
run: pnpm test:js:coverage
38+
run: pnpm test:coverage
3939

4040
- name: Upload coverage to Codecov
4141
uses: codecov/codecov-action@v4

config/getJestJsProjectConfig.js

-16
This file was deleted.

config/getJestProjectConfig.js

-33
This file was deleted.

config/getJestTsProjectConfig.js

-21
This file was deleted.

config/getTestMatch.js

-20
This file was deleted.

config/jestConfig.js

-45
This file was deleted.

config/projectRoot.js

-3
This file was deleted.

eslint.config.mjs

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import js from '@eslint/js';
22
import tsEslint from 'typescript-eslint';
33
import tsEslintParser from '@typescript-eslint/parser';
4-
//import vitest from 'eslint-plugin-vitest';
4+
import vitest from 'eslint-plugin-vitest';
55
import eslintImport from 'eslint-plugin-import';
66
import { fixupPluginRules } from '@eslint/compat';
77

@@ -196,25 +196,25 @@ export default tsEslint.config(
196196
},
197197
},
198198
},
199-
// {
200-
// files: ['**/*.spec.ts'],
201-
// plugins: {
202-
// vitest
203-
// },
204-
// rules: {
205-
// ...vitest.configs.recommended.rules,
206-
// ...vitest.configs.all.rules,
207-
// '@typescript-eslint/unbound-method': 'off',
208-
// '@typescript-eslint/no-confusing-void-expression': 'off',
209-
// '@typescript-eslint/no-empty-function': "off",
210-
// '@typescript-eslint/no-magic-numbers': 'off',
211-
// '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
212-
// 'vitest/consistent-test-filename': 'off',
213-
// 'vitest/max-expects': 'off',
214-
// 'vitest/no-hooks': 'off',
215-
// 'vitest/prefer-expect-assertions': 'off',
216-
// 'vitest/prefer-strict-equal': 'error',
217-
// 'vitest/valid-title': 'off',
218-
// },
219-
// },
199+
{
200+
files: ['**/*.spec.ts'],
201+
plugins: {
202+
vitest
203+
},
204+
rules: {
205+
...vitest.configs.recommended.rules,
206+
...vitest.configs.all.rules,
207+
'@typescript-eslint/unbound-method': 'off',
208+
'@typescript-eslint/no-confusing-void-expression': 'off',
209+
'@typescript-eslint/no-empty-function': "off",
210+
'@typescript-eslint/no-magic-numbers': 'off',
211+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
212+
'vitest/consistent-test-filename': 'off',
213+
'vitest/max-expects': 'off',
214+
'vitest/no-hooks': 'off',
215+
'vitest/prefer-expect-assertions': 'off',
216+
'vitest/prefer-strict-equal': 'error',
217+
'vitest/valid-title': 'off',
218+
},
219+
},
220220
);

jest.config.js

-3
This file was deleted.

jest.js.config.js

-3
This file was deleted.

package.json

+9-14
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,22 @@
2929
"url": "https://github.com/adrianmjim/nestjs-supabase-js/issues"
3030
},
3131
"devDependencies": {
32-
"@jest/globals": "29.7.0",
32+
"@eslint/compat": "1.2.1",
33+
"@eslint/js": "9.13.0",
3334
"@types/node": "20.16.15",
3435
"@typescript-eslint/eslint-plugin": "8.11.0",
3536
"@typescript-eslint/parser": "8.11.0",
36-
"@eslint/compat": "1.2.1",
37-
"@eslint/js": "9.13.0",
37+
"@vitest/coverage-v8": "2.1.3",
3838
"eslint": "9.13.0",
3939
"eslint-import-resolver-typescript": "3.6.3",
4040
"eslint-plugin-import": "2.31.0",
41-
"eslint-plugin-jest": "28.8.3",
4241
"eslint-plugin-prettier": "5.2.1",
43-
"jest": "29.7.0",
42+
"eslint-plugin-vitest": "^0.5.4",
4443
"prettier": "3.3.3",
4544
"rimraf": "6.0.1",
46-
"ts-jest": "29.2.5",
47-
"ts-node": "10.9.2",
4845
"typescript": "5.6.3",
49-
"typescript-eslint": "8.11.0"
46+
"typescript-eslint": "8.11.0",
47+
"vitest": "2.1.3"
5048
},
5149
"peerDependencies": {
5250
"@nestjs/common": "^10.2.7 || ^9.4.0",
@@ -63,11 +61,8 @@
6361
"lint": "eslint ./src",
6462
"prebuild": "pnpm run build:clean",
6563
"publish:package": "pnpm publish",
66-
"test": "jest --config=jest.config.js",
67-
"test:integration:js": "pnpm run test:js --selectProjects Integration",
68-
"test:js": "jest --config=jest.js.config.js",
69-
"test:js:coverage": "pnpm run test:js --coverage",
70-
"test:uncommitted": "pnpm run test --changedSince=HEAD",
71-
"test:unit:js": "pnpm run test:js --selectProjects Unit"
64+
"test": "TZ=$npm_package_config_TZ vitest run",
65+
"test:coverage": "pnpm run test --coverage",
66+
"test:uncommitted": "pnpm run test --changed HEAD"
7267
}
7368
}

0 commit comments

Comments
 (0)