Skip to content

Commit d2af8b7

Browse files
committed
✅ Switch from Jest to Vitest for faster testing
1 parent f1eac5d commit d2af8b7

11 files changed

+510
-3442
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ build/
1313
.vscode/settings.json
1414

1515
test.ts
16+
test-script.ts
1617
test-udp.ts
1718

1819
### Node ###

jest.config.js

-7
This file was deleted.

package.json

+4-7
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,20 @@
2727
"build:doc": "jsdoc2md --files src/**/*.ts --configure ./jsdoc2md.json > ./API.md",
2828
"version": "node hooks/prepublish.js && git add midi-script/version.py && auto-changelog -p -l 100 && git add CHANGELOG.md",
2929
"build": "tsc",
30-
"test": "jest --runInBand"
30+
"test": "vitest --run --no-threads"
3131
},
3232
"devDependencies": {
33-
"@types/jest": "^26.0.23",
3433
"@types/lodash": "^4.14.194",
3534
"@types/node": "^20.3.0",
3635
"@types/node-uuid": "^0.0.28",
3736
"@types/semver": "^7.3.6",
3837
"@types/uuid": "^8.3.0",
3938
"auto-changelog": "^2.3.0",
40-
"jest": "^27.0.3",
41-
"jest-extended": "^0.11.5",
4239
"lodash": "^4.17.21",
4340
"p-all": "^3",
44-
"ts-jest": "^29.1.0",
45-
"ts-node": "^10.9.1",
46-
"typescript": "^5.1.3"
41+
"tsx": "^3.12.7",
42+
"typescript": "^5.1.3",
43+
"vitest": "^0.32.4"
4744
},
4845
"dependencies": {
4946
"lru-cache": "^7.14.0",

src/ns/application-view.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { describe, it } from "vitest";
12
import { withAbleton } from "../util/tests";
23
import { GettableProperties } from "./application-view";
3-
import "jest-extended";
44

55
const gettableProps: (keyof GettableProperties)[] = [
66
"browse_mode",

src/ns/application.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { describe, it } from "vitest";
12
import { withAbleton } from "../util/tests";
23
import { GettableProperties } from "./application";
3-
import "jest-extended";
44

55
const gettableProps: (keyof GettableProperties)[] = [
66
"major_version",

src/ns/mixer-device.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { describe, it } from "vitest";
12
import { withAbleton } from "../util/tests";
23
import { GettableProperties } from "./mixer-device";
3-
import "jest-extended";
44

55
const gettableProps: (keyof GettableProperties)[] = [
66
//"crossfade_assign", (not applicable to the master track)

src/ns/song-view.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it } from "vitest";
12
import { withAbleton } from "../util/tests";
23
import { GettableProperties } from "./song-view";
34

src/ns/song.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { describe, it, expect } from "vitest";
12
import { withAbleton } from "../util/tests";
23
import { GettableProperties } from "./song";
3-
import "jest-extended";
44

55
const gettableProps: (keyof GettableProperties)[] = [
66
"arrangement_overdub",
@@ -60,15 +60,15 @@ describe("Song", () => {
6060
it("should return the proper types for properties", async () => {
6161
await withAbleton(async (ab) => {
6262
const songTime = await ab.song.get("current_song_time");
63-
expect(songTime).toBeNumber();
63+
expect(songTime).toBeTypeOf("number");
6464

6565
const clipTriggerQuantization = await ab.song.get(
6666
"clip_trigger_quantization",
6767
);
68-
expect(clipTriggerQuantization).toBeString();
68+
expect(clipTriggerQuantization).toBeTypeOf("string");
6969

7070
const isPlaying = await ab.song.get("is_playing");
71-
expect(isPlaying).toBeBoolean();
71+
expect(isPlaying).toBeTypeOf("boolean");
7272
});
7373
});
7474

src/util/package-version.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { describe, it, expect } from "vitest";
12
import { getPackageVersion } from "./package-version";
23
import { valid } from "semver";
34

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"include": ["./src/**/*", "./scripts/**/*"],
3-
"exclude": [],
3+
"exclude": ["**/*.spec.ts"],
44
"compilerOptions": {
55
"module": "commonjs",
66
"target": "ES2022",

0 commit comments

Comments
 (0)