@cbrl/testing 0.2.0 → 0.4.0
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/dist/a11y.mjs +7 -6
- package/package.json +9 -9
package/dist/a11y.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { axe, toHaveNoViolations } from "jest-axe";
|
|
2
|
-
import {
|
|
2
|
+
import { assert } from "vitest";
|
|
3
3
|
// src/vitest/a11y.ts
|
|
4
4
|
/**
|
|
5
5
|
* Shared accessibility assertion for jsdom component tests, backed by axe-core
|
|
@@ -10,13 +10,14 @@ import { expect } from "vitest";
|
|
|
10
10
|
* const { container } = render(<Button>Salvar</Button>)
|
|
11
11
|
* await expectNoA11yViolations(container)
|
|
12
12
|
*
|
|
13
|
-
* The jest-axe matcher
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* The jest-axe matcher runs directly instead of through `expect.extend`, so
|
|
14
|
+
* importing this module has no side effects and needs no matcher type
|
|
15
|
+
* augmentation (Vitest 5 no longer merges jest-axe's `jest.Matchers` typings
|
|
16
|
+
* into `Assertion`). Requires a DOM environment (`environment: 'jsdom'`).
|
|
16
17
|
*/
|
|
17
|
-
expect.extend(toHaveNoViolations);
|
|
18
18
|
async function expectNoA11yViolations(container) {
|
|
19
19
|
const results = await axe(container, { rules: { region: { enabled: false } } });
|
|
20
|
-
|
|
20
|
+
const result = toHaveNoViolations.toHaveNoViolations(results);
|
|
21
|
+
assert(result.pass, result.message());
|
|
21
22
|
}
|
|
22
23
|
export { expectNoA11yViolations };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cbrl/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Test helpers: Vitest coverage base, server-only shim, jsdom polyfills, jest-axe a11y matcher, and Playwright E2E/smoke presets.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Kayron Cabral",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"jest-axe": "^
|
|
38
|
+
"jest-axe": "^11.0.0",
|
|
39
39
|
"@cbrl/env": "^0.1.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
47
47
|
"@playwright/test": "^1.56.1",
|
|
48
48
|
"@types/jest-axe": "^3.5.9",
|
|
49
|
-
"@types/node": "^
|
|
50
|
-
"@vitest/coverage-v8": "^
|
|
49
|
+
"@types/node": "^26.6.6",
|
|
50
|
+
"@vitest/coverage-v8": "^5.1.1",
|
|
51
51
|
"eslint": "^9.39.4",
|
|
52
|
-
"jsdom": "^
|
|
52
|
+
"jsdom": "^31.0.1",
|
|
53
53
|
"publint": "^0.3.25",
|
|
54
54
|
"tsdown": "^0.23.7",
|
|
55
|
-
"typescript": "^
|
|
56
|
-
"vitest": "^
|
|
57
|
-
"@cbrl/eslint-config": "0.
|
|
58
|
-
"@cbrl/tsconfig": "0.1.
|
|
55
|
+
"typescript": "^6.0.3",
|
|
56
|
+
"vitest": "^5.1.1",
|
|
57
|
+
"@cbrl/eslint-config": "0.3.0",
|
|
58
|
+
"@cbrl/tsconfig": "0.1.1"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|