jest-matcher-specific-error 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/matcher.js +1 -2
- package/package.json +19 -20
- package/types/vitest.d.ts +6 -2
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ export default defineConfig({
|
|
|
25
25
|
|
|
26
26
|
Jest: same as [Other Jest matchers](https://jest-extended.jestcommunity.dev/docs/getting-started/typescript).
|
|
27
27
|
|
|
28
|
-
Vitest: add `"jest-matcher-specific-error/types/vitest"` to `compilerOptions.types` in `tsconfig.json`, or add `import "jest-matcher-specific-error/types/vitest";` to a `.d.ts` file.
|
|
28
|
+
Vitest (5+): add `"jest-matcher-specific-error/types/vitest"` to `compilerOptions.types` in `tsconfig.json`, or add `import "jest-matcher-specific-error/types/vitest";` to a `.d.ts` file.
|
|
29
29
|
|
|
30
30
|
# Usage
|
|
31
31
|
```typescript
|
package/dist/src/matcher.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toMatchError =
|
|
3
|
+
exports.toMatchError = toMatchError;
|
|
4
4
|
function errorToObject(error) {
|
|
5
5
|
const { stack, ...publicFields } = error;
|
|
6
6
|
return {
|
|
@@ -46,4 +46,3 @@ function toMatchError(gotErrorFactory, expectedError) {
|
|
|
46
46
|
message: () => diff.join("\n"),
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
exports.toMatchError = toMatchError;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-matcher-specific-error",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Make sure your function really throws what you expect",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"prepare": "yarn build",
|
|
29
29
|
"build": "rm -rf ./dist; tsc",
|
|
30
|
-
"lint:check": "eslint .
|
|
30
|
+
"lint:check": "eslint .",
|
|
31
31
|
"lint:lockfile": "lockfile-lint --path yarn.lock",
|
|
32
32
|
"lint": "yarn lint:check --fix",
|
|
33
33
|
"test": "jest",
|
|
34
|
-
"test:vitest": "vitest run test/vitest.test.
|
|
34
|
+
"test:vitest": "vitest run test/vitest.test.ts"
|
|
35
35
|
},
|
|
36
36
|
"lockfile-lint": {
|
|
37
37
|
"allowed-hosts": [
|
|
@@ -39,24 +39,23 @@
|
|
|
39
39
|
]
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"eslint": "^
|
|
48
|
-
"eslint-
|
|
49
|
-
"eslint-plugin-
|
|
50
|
-
"eslint-plugin-
|
|
51
|
-
"eslint-plugin-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"lockfile-lint": "^4.12.1",
|
|
56
|
-
"prettier": "^2.1.2",
|
|
42
|
+
"@eslint/js": "^10.0.1",
|
|
43
|
+
"@types/jest": "^30.0.0",
|
|
44
|
+
"@types/node": "^24.19.2",
|
|
45
|
+
"@types/strip-color": "^0.1.2",
|
|
46
|
+
"eslint": "^10.13.0",
|
|
47
|
+
"eslint-config-prettier": "^10.1.8",
|
|
48
|
+
"eslint-plugin-jest": "^29.17.0",
|
|
49
|
+
"eslint-plugin-n": "^18.5.0",
|
|
50
|
+
"eslint-plugin-prettier": "^5.5.7",
|
|
51
|
+
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
52
|
+
"jest": "^30.5.2",
|
|
53
|
+
"lockfile-lint": "^5.1.0",
|
|
54
|
+
"prettier": "^3.9.10",
|
|
57
55
|
"strip-color": "^0.1.0",
|
|
58
|
-
"ts-jest": "^
|
|
59
|
-
"typescript": "
|
|
56
|
+
"ts-jest": "^29.4.15",
|
|
57
|
+
"typescript": "~6.0.3",
|
|
58
|
+
"typescript-eslint": "^8.72.0",
|
|
60
59
|
"vite": "^8.3.5",
|
|
61
60
|
"vitest": "^5.0.5"
|
|
62
61
|
}
|
package/types/vitest.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import "vitest";
|
|
2
2
|
|
|
3
3
|
declare module "vitest" {
|
|
4
|
-
interface Matchers<
|
|
5
|
-
|
|
4
|
+
interface Matchers<
|
|
5
|
+
R extends void | Promise<void> = void | Promise<void>,
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- must match Vitest's declaration
|
|
7
|
+
T = unknown,
|
|
8
|
+
> {
|
|
9
|
+
toMatchError(error: Error): R;
|
|
6
10
|
}
|
|
7
11
|
}
|