Skip to content

Commit 5d002cc

Browse files
authored
chore(release): 4.12.1 (#5152)
### Bug Fixes - **axe.d.ts:** make enabled property of RuleMetadata optional ([#5129](#5129)) ([7eb3d2d](7eb3d2d))
2 parents e260c7e + c3fe4b5 commit 5d002cc

43 files changed

Lines changed: 6593 additions & 2321 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/nightly-tests.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ jobs:
4040
npm run build
4141
- name: Run Firefox Nightly Browser Tests
4242
env:
43+
WTR_BROWSER: firefox-nightly
4344
FIREFOX_NIGHTLY_BIN: ${{ steps.install-deps.outputs.firefox-path }}
44-
run: npm run test -- --browsers FirefoxNightly
45+
run: npm run test
4546
- name: Run Chrome Beta Browser Tests
4647
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
4748
env:
49+
WTR_BROWSER: chrome
4850
CHROME_BIN: ${{ steps.install-deps.outputs.chrome-path }}
4951
CHROMEDRIVER_BIN: ${{ steps.install-deps.outputs.chromedriver-path }}
50-
run: npm run test -- --browsers Chrome
52+
run: npm run test
5153
act:
5254
runs-on: ubuntu-24.04
5355
timeout-minutes: 10

.github/workflows/test.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ jobs:
8686
- *build
8787
- name: Run Tests Against Chrome
8888
env:
89+
WTR_BROWSER: chrome
8990
CHROME_BIN: ${{ steps.install-deps.outputs.chrome-path }}
9091
CHROMEDRIVER_BIN: ${{ steps.install-deps.outputs.chromedriver-path }}
91-
run: npm run test -- --browsers Chrome
92+
run: npm run test
9293
- name: Run Chrome Integration Tests
9394
env:
9495
CHROME_BIN: ${{ steps.install-deps.outputs.chrome-path }}
@@ -106,8 +107,9 @@ jobs:
106107
- *build
107108
- name: Run Tests Against Firefox
108109
env:
110+
WTR_BROWSER: firefox
109111
FIREFOX_BIN: ${{ steps.install-deps.outputs.firefox-path }}
110-
run: npm run test -- --browsers Firefox
112+
run: npm run test
111113
- name: Run Firefox Integration Tests
112114
env:
113115
FIREFOX_BIN: ${{ steps.install-deps.outputs.firefox-path }}
@@ -129,6 +131,8 @@ jobs:
129131
uses: ./.github/actions/install-deps
130132
- *build
131133
- name: Run Tests Against Examples
134+
env:
135+
PUPPETEER_EXECUTABLE_PATH: ${{ steps.install-deps.outputs.chrome-path }}
132136
run: npm run test:examples
133137

134138
test_act:

.vscode/launch.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
{
55
"type": "chrome",
66
"request": "attach",
7-
"name": "Attach to Karma test:debug",
7+
"name": "Attach to WTR test:debug",
88
"address": "localhost",
9-
"port": 9765, // keep in sync with debugPort in karma.conf.js
9+
"port": 9765, // keep in sync with debugPort in wtr.config.mjs chrome-debug group
1010
"webRoot": "${workspaceFolder}",
1111
"sourceMaps": true,
1212
"sourceMapPathOverrides": {
13-
"*": "${webRoot}/*",
14-
"base/*": "${webRoot}/*"
13+
"*": "${webRoot}/*"
1514
}
1615
}
1716
]

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [4.12.1](https://github.com/dequelabs/axe-core/compare/v4.12.0...v4.12.1) (2026-06-09)
6+
7+
### Bug Fixes
8+
9+
- **axe.d.ts:** make enabled property of RuleMetadata optional ([#5129](https://github.com/dequelabs/axe-core/issues/5129)) ([7eb3d2d](https://github.com/dequelabs/axe-core/commit/7eb3d2d7ce283926a786c8a0fbf2a52c81d5e694))
10+
511
## [4.12.0](https://github.com/dequelabs/axe-core/compare/v4.11.4...v4.12.0) (2026-06-01)
612

713
### Features

CONTRIBUTING.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ We expect all code to be 100% covered by tests. We don't have or want code cover
7171

7272
Tests should be added to the `test` directory using the same file path and name of the source file the test is for. For example, the source file `lib/commons/text/sanitize.js` should have a test file at `test/commons/text/sanitize.js`.
7373

74-
Axe uses Karma / Mocha / Chai as its testing framework.
74+
Axe uses Web Test Runner / Mocha / Chai / Sinon as its testing framework.
7575

7676
### Documentation and Comments
7777

@@ -202,13 +202,12 @@ If you need to debug the unit tests in a browser, you can run:
202202
npm run test:debug
203203
```
204204

205-
This will start the Karma server and open up the Chrome browser. Click the `Debug` button to start debugging the tests. You can either use that browser's debugger or attach an external debugger on port 9765; [a VS Code launch profile](./.vscode/launch.json) is provided. You can also navigate to the listed URL in your browser of choice to debug tests using that browser.
205+
This will start the Web Test Runner server. Press `D` to open the Chrome browser. Click the link to a test to start debugging. You can either use that browser's debugger or attach an external debugger on port 9765; [a VS Code launch profile](./.vscode/launch.json) is provided. You can also navigate to the listed URL in your browser of choice to debug tests using that browser.
206206

207-
Because the amount of tests is so large, it's recommended to debug only a specific set of unit tests rather than the whole test suite. You can use the `testDirs` argument when using the debug command and pass a specific test directory. The test directory names are the same as those used for `test:unit:*`:
207+
Because the amount of tests is so large, it's recommended to debug only a specific set of unit tests rather than the whole test suite. You can use the `files` argument when using the debug command and pass a test files glob pattern.
208208

209209
```console
210-
# accepts a single directory or a comma-separated list of directories
211-
npm run test:debug -- testDirs=core,commons
210+
npm run test:debug -- --files 'test/core'
212211
```
213212

214213
## Using axe with TypeScript

Gruntfile.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = function (grunt) {
3636

3737
// run tests only for affected files instead of all tests
3838
grunt.event.on('watch', function (action, filepath) {
39-
grunt.config.set('watch.file', filepath);
39+
grunt.option('changed-file', filepath);
4040
});
4141

4242
process.env.NODE_NO_HTTP2 = 1; // to hide node warning - (node:18740) ExperimentalWarning: The http2 module is an experimental API.
@@ -45,7 +45,7 @@ module.exports = function (grunt) {
4545
pkg: grunt.file.readJSON('package.json'),
4646
clean: {
4747
core: ['dist', 'tmp/core', 'tmp/rules.js', 'axe.js', 'axe.*.js'],
48-
tests: ['tmp/integration-tests.js']
48+
tests: ['tmp/integration-tests']
4949
},
5050
babel: {
5151
options: {
@@ -262,9 +262,7 @@ module.exports = function (grunt) {
262262
}
263263
},
264264
test: {
265-
data: {
266-
testFile: '<%= watch.file %>'
267-
}
265+
data: {}
268266
},
269267
watch: {
270268
axe: {
@@ -274,7 +272,7 @@ module.exports = function (grunt) {
274272
},
275273
tests: {
276274
options: { spawn: false },
277-
files: ['test/**/*'],
275+
files: ['test/**/*', '!test/integration/full/**/*'],
278276
tasks: ['test']
279277
}
280278
},

axe.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ declare namespace axe {
352352
helpUrl: string;
353353
tags: string[];
354354
actIds?: string[];
355-
enabled: boolean;
355+
enabled?: boolean;
356356
}
357357
interface SerialDqElement {
358358
source: string;
@@ -623,7 +623,9 @@ declare namespace axe {
623623
* @param {Array} tags Optional array of tags
624624
* @return {Array} Array of rules
625625
*/
626-
function getRules(tags?: string[]): RuleMetadata[];
626+
function getRules(
627+
tags?: string[]
628+
): (Omit<RuleMetadata, 'enabled'> & { enabled: boolean })[];
627629

628630
/**
629631
* Restores the default axe configuration

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "axe-core",
3-
"version": "4.12.0",
3+
"version": "4.12.1",
44
"deprecated": true,
55
"contributors": [
66
{
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
'use strict';
2+
3+
/**
4+
* Generates test files for integration rule tests in tmp/integration-tests/.
5+
* This replaces the Karma preprocessor (test/integration/rules/preprocessor.js)
6+
* that combined *.json + *.html pairs into executable JS at serve-time.
7+
*
8+
* Output files are picked up by web-test-runner via the test:unit:integration script.
9+
*/
10+
11+
const path = require('path');
12+
const fs = require('fs');
13+
const { globSync } = require('glob');
14+
15+
const rootDir = path.join(__dirname, '..');
16+
const rulesDir = path.join(rootDir, 'test', 'integration', 'rules');
17+
const outDir = path.join(rootDir, 'tmp', 'integration-tests');
18+
const runnerTemplate = fs.readFileSync(
19+
path.join(rulesDir, 'runner.js'),
20+
'utf-8'
21+
);
22+
23+
// Clean and recreate output directory
24+
fs.rmSync(outDir, { recursive: true, force: true });
25+
fs.mkdirSync(outDir, { recursive: true });
26+
27+
const jsonFiles = globSync('**/*.json', { cwd: rulesDir });
28+
29+
let count = 0;
30+
for (const relPath of jsonFiles) {
31+
const jsonPath = path.join(rulesDir, relPath);
32+
const htmlPath = jsonPath.replace(/\.json$/, '.html');
33+
34+
if (!fs.existsSync(htmlPath)) {
35+
// Some JSON files may not have a sibling HTML (e.g. nested frame fixtures)
36+
continue;
37+
}
38+
39+
let test;
40+
try {
41+
test = JSON.parse(fs.readFileSync(jsonPath, 'utf-8'));
42+
} catch (e) {
43+
throw new Error(`Unable to parse ${jsonPath}: ${e.message}`);
44+
}
45+
46+
const html = fs.readFileSync(htmlPath, 'utf-8');
47+
test.content = html;
48+
49+
const outPath = path.join(outDir, relPath.replace(/\.json$/, '.test.js'));
50+
const outDirForFile = path.dirname(outPath);
51+
fs.mkdirSync(outDirForFile, { recursive: true });
52+
53+
const output = runnerTemplate.replace('{}; /*tests*/', JSON.stringify(test));
54+
fs.writeFileSync(outPath, output, 'utf-8');
55+
count++;
56+
}
57+
58+
console.log(
59+
`Generated ${count} integration test files in tmp/integration-tests/`
60+
);

build/tasks/test.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const execSync = require('child_process').execSync;
22
const chalk = require('chalk');
3+
const path = require('node:path');
34

45
/*eslint-env node */
56
('use strict');
@@ -9,12 +10,37 @@ module.exports = function (grunt) {
910
'test',
1011
'This task runs unit tests based on which file was changed',
1112
function () {
12-
const testFile = this.data.testFile;
13+
const testFile = grunt.option('changed-file');
1314
console.log(`${chalk.green('>>')} File "${testFile}"`);
15+
const files = [];
1416

15-
execSync(`npm run test:unit -- testFiles=${testFile}`, {
16-
stdio: 'inherit'
17-
});
17+
// build the integration tests before testing
18+
if (
19+
(testFile.startsWith(path.join('test', 'integration', 'rules')) &&
20+
testFile.endsWith('.html')) ||
21+
testFile.endsWith('.json')
22+
) {
23+
execSync('npm run build:integration-tests', { stdio: 'inherit' });
24+
const rule = testFile.split(path.sep)[3];
25+
files.push(
26+
path.join('tmp', 'integration-tests', rule, rule + '.test.js')
27+
);
28+
}
29+
30+
if (
31+
testFile &&
32+
testFile.startsWith(`test${path.sep}`) &&
33+
testFile.endsWith('.js')
34+
) {
35+
files.push(testFile);
36+
}
37+
38+
let cmd = 'npm run test:unit';
39+
if (files.length) {
40+
cmd += ` -- --files "${files.join(',')}"`;
41+
}
42+
43+
execSync(cmd, { stdio: 'inherit' });
1844
}
1945
);
2046
};

0 commit comments

Comments
 (0)