Skip to content

Commit 9c88168

Browse files
authored
fix!: add support for vitest v1 (#5)
BREAKING CHANGE: drop CJS export, Vitest is ESM only
1 parent 49def93 commit 9c88168

File tree

4 files changed

+752
-601
lines changed

4 files changed

+752
-601
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
[![ci badge][]][ci]
55
[![coverage badge][]][coverage]
66

7+
Read the introductory post: [Better mocks in Vitest][better-mocks]
8+
79
Stub behaviors of [Vitest][] mock functions with a small, readable API. Inspired by [testdouble.js][] and [jest-when][].
810

911
```shell
1012
npm install --save-dev vitest-when
1113
```
1214

15+
[better-mocks]: https://michael.cousins.io/articles/2023-06-30-better-stubs/
1316
[vitest]: https://vitest.dev/
1417
[testdouble.js]: https://github.com/testdouble/testdouble.js/
1518
[jest-when]: https://github.com/timkindberg/jest-when

package.json

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
"url": "https://github.com/mcous/vitest-when.git"
1717
},
1818
"license": "MIT",
19-
"author": "Michael Cousins <[email protected]> (https://mike.cousins.io)",
19+
"author": "Michael Cousins <[email protected]> (https://michael.cousins.io)",
2020
"type": "module",
2121
"exports": {
2222
".": {
2323
"types": "./dist/vitest-when.d.ts",
24-
"import": "./dist/vitest-when.js",
25-
"require": "./dist/vitest-when.cjs"
24+
"import": "./dist/vitest-when.js"
2625
}
2726
},
2827
"types": "./dist/vitest-when.d.ts",
@@ -34,11 +33,11 @@
3433
"_eslint": "eslint --ignore-path .lintignore \"**/*.ts\"",
3534
"_prettier": "prettier --ignore-path .lintignore \"**/*.@(ts|json|yaml|md)\"",
3635
"all": "concurrently -g pnpm:coverage pnpm:build pnpm:check:*",
37-
"build": "tsup --clean --sourcemap --dts --format esm,cjs --target node14 src/vitest-when.ts",
36+
"build": "tsup --clean --sourcemap --dts --format esm --target node14 src/vitest-when.ts",
3837
"build-and-check": "concurrently -g pnpm:build pnpm:check:*",
3938
"check:format": "pnpm run _prettier --check",
4039
"check:lint": "pnpm run _eslint",
41-
"check:types": "vitest typecheck --run",
40+
"check:types": "vitest --typecheck.only --run",
4241
"coverage": "vitest run --coverage",
4342
"format": "pnpm run _prettier --write && pnpm run _eslint --fix",
4443
"test": "vitest"
@@ -51,34 +50,34 @@
5150
"extends": "@mcous/eslint-config"
5251
},
5352
"devDependencies": {
54-
"@mcous/eslint-config": "0.3.3",
53+
"@mcous/eslint-config": "0.4.2",
5554
"@mcous/prettier-config": "0.3.0",
5655
"@mcous/typescript-config": "0.2.1",
57-
"@typescript-eslint/eslint-plugin": "6.7.4",
58-
"@typescript-eslint/parser": "6.7.4",
59-
"@vitest/coverage-istanbul": "^0.31.0",
60-
"@vitest/expect": "^0.31.0",
61-
"concurrently": "^8.0.1",
62-
"eslint": "8.51.0",
56+
"@typescript-eslint/eslint-plugin": "6.13.1",
57+
"@typescript-eslint/parser": "6.13.1",
58+
"@vitest/coverage-istanbul": "^1.0.0-beta.6",
59+
"@vitest/expect": "^1.0.0-beta.6",
60+
"concurrently": "^8.2.2",
61+
"eslint": "8.54.0",
6362
"eslint-config-prettier": "9.0.0",
6463
"eslint-plugin-promise": "6.1.1",
65-
"eslint-plugin-sonarjs": "0.21.0",
66-
"eslint-plugin-unicorn": "48.0.1",
67-
"prettier": "3.0.3",
68-
"tsup": "^6.7.0",
69-
"typescript": "5.2.2",
70-
"vitest": "^0.31.0"
64+
"eslint-plugin-sonarjs": "0.23.0",
65+
"eslint-plugin-unicorn": "49.0.0",
66+
"prettier": "3.1.0",
67+
"tsup": "^8.0.1",
68+
"typescript": "5.3.2",
69+
"vitest": "^1.0.0-beta.6"
7170
},
7271
"peerDependencies": {
73-
"@vitest/expect": ">=0.31.0 <1.0.0",
74-
"vitest": ">=0.31.0 <1.0.0"
72+
"@vitest/expect": ">=0.31.0 <2.0.0",
73+
"vitest": ">=0.31.0 <2.0.0"
7574
},
7675
"peerDependenciesMeta": {
7776
"@vitest/expect": {
7877
"optional": true
7978
}
8079
},
81-
"packageManager": "pnpm@8.8.0+sha256.d713a5750e41c3660d1e090608c7f607ad00d1dd5ba9b6552b5f390bf37924e9",
80+
"packageManager": "pnpm@8.11.0+sha256.5858806c3b292cbec89b5533662168a957358e2bbd86431516d441dc1aface89",
8281
"publishConfig": {
8382
"access": "public",
8483
"provenance": true

0 commit comments

Comments
 (0)