Skip to content

Commit 8ef23e2

Browse files
authored
Merge pull request #280 from unipept/chore-migrate-to-vitest-10559607753500242316
Migrate to Vitest
2 parents e74aeb0 + 7a11f9d commit 8ef23e2

20 files changed

+610
-1978
lines changed

jest.config.ts

Lines changed: 0 additions & 203 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"build": "yarn run tsc",
1818
"lint": "yarn run eslint",
19-
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' yarn run jest",
19+
"test": "vitest run",
2020
"typecheck": "yarn tsc --skipLibCheck --noEmit",
2121
"peptfilter": "yarn run tsx bin/peptfilter.ts",
2222
"prot2pept": "yarn run tsx bin/prot2pept.ts",
@@ -32,19 +32,17 @@
3232
},
3333
"devDependencies": {
3434
"@eslint/js": "^9.5.0",
35-
"@types/jest": "^29.5.12",
3635
"@types/node": "^24.0.8",
3736
"@typescript-eslint/eslint-plugin": "^7.13.1",
3837
"@typescript-eslint/parser": "^7.13.1",
3938
"eslint": "9.x",
4039
"globals": "^16.0.0",
41-
"jest": "^29.7.0",
4240
"mock-stdin": "^1.0.0",
4341
"np": "^10.0.7",
44-
"ts-jest": "^29.1.5",
4542
"ts-node": "^10.9.2",
4643
"tsx": "^4.15.6",
4744
"typescript": "^5.4.5",
48-
"typescript-eslint": "^8.16.0"
45+
"typescript-eslint": "^8.16.0",
46+
"vitest": "^4.0.16"
4947
}
5048
}

tests/commands/peptfilter.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Peptfilter } from '../../lib/commands/peptfilter';
2-
import { jest } from '@jest/globals';
2+
import { vi } from 'vitest';
33
import * as mock from 'mock-stdin';
44

55
let output: string[];
66
let error: string[];
77
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8-
const writeSpy = jest
8+
const writeSpy = vi
99
.spyOn(process.stdout, "write")
1010
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
11-
const errorSpy = jest
11+
const errorSpy = vi
1212
.spyOn(process.stderr, "write")
1313
.mockImplementation((data: unknown) => { error.push(data as string); return true; });
1414

tests/commands/prot2pept.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Prot2pept } from '../../lib/commands/prot2pept';
2-
import { jest } from '@jest/globals';
2+
import { vi } from 'vitest';
33
import * as mock from 'mock-stdin';
44

55
let output: string[];
66
let error: string[];
77
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8-
const writeSpy = jest
8+
const writeSpy = vi
99
.spyOn(process.stdout, "write")
1010
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
11-
const errorSpy = jest
11+
const errorSpy = vi
1212
.spyOn(process.stderr, "write")
1313
.mockImplementation((data: unknown) => { error.push(data as string); return true; });
1414

tests/commands/unipept/pept2ec.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { jest } from '@jest/globals';
1+
import { vi } from 'vitest';
22
import { Pept2ec } from "../../../lib/commands/unipept/pept2ec";
33
import { setupMockFetch } from '../../mocks/mockFetch';
44

55
let output: string[];
6-
jest
6+
vi
77
.spyOn(process.stdout, "write")
88
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
99

tests/commands/unipept/pept2funct.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { jest } from '@jest/globals';
1+
import { vi } from 'vitest';
22
import { Pept2funct } from "../../../lib/commands/unipept/pept2funct";
33
import { setupMockFetch } from '../../mocks/mockFetch';
44

55
let output: string[];
6-
jest
6+
vi
77
.spyOn(process.stdout, "write")
88
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
99

tests/commands/unipept/pept2go.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { jest } from '@jest/globals';
1+
import { vi } from 'vitest';
22
import { Pept2go } from "../../../lib/commands/unipept/pept2go";
33
import { setupMockFetch } from '../../mocks/mockFetch';
44

55
let output: string[];
6-
jest
6+
vi
77
.spyOn(process.stdout, "write")
88
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
99

tests/commands/unipept/pept2interpro.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { jest } from '@jest/globals';
1+
import { vi } from 'vitest';
22
import { Pept2interpro } from "../../../lib/commands/unipept/pept2interpro";
33
import { setupMockFetch } from '../../mocks/mockFetch';
44

55
let output: string[];
6-
jest
6+
vi
77
.spyOn(process.stdout, "write")
88
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
99

tests/commands/unipept/pept2lca.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { jest } from '@jest/globals';
1+
import { vi } from 'vitest';
22
import { Pept2lca } from "../../../lib/commands/unipept/pept2lca";
33
import { setupMockFetch } from '../../mocks/mockFetch';
44

55
let output: string[];
6-
jest
6+
vi
77
.spyOn(process.stdout, "write")
88
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
99

tests/commands/unipept/pept2prot.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { jest } from '@jest/globals';
1+
import { vi } from 'vitest';
22
import { Pept2prot } from "../../../lib/commands/unipept/pept2prot";
33
import { setupMockFetch } from '../../mocks/mockFetch';
44

55
let output: string[];
6-
jest
6+
vi
77
.spyOn(process.stdout, "write")
88
.mockImplementation((data: unknown) => { output.push(data as string); return true; });
99

0 commit comments

Comments
 (0)