Skip to content

Commit 1309df7

Browse files
authored
feat(plugin-axe): add authentication support via setup script (#1198)
1 parent 91f50cf commit 1309df7

38 files changed

+490
-177
lines changed

code-pushup.preset.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/* eslint-disable @nx/enforce-module-boundaries */
22
import { createProjectGraphAsync } from '@nx/devkit';
33
import type { CoreConfig, PluginUrls } from './packages/models/src/index.js';
4-
import axePlugin, { axeGroupRefs } from './packages/plugin-axe/src/index.js';
4+
import axePlugin, {
5+
type AxePluginOptions,
6+
axeGroupRefs,
7+
} from './packages/plugin-axe/src/index.js';
58
import coveragePlugin, {
69
type CoveragePluginConfig,
710
getNxCoveragePaths,
@@ -217,8 +220,11 @@ export async function configureLighthousePlugin(
217220
};
218221
}
219222

220-
export function configureAxePlugin(urls: PluginUrls): CoreConfig {
221-
const axe = axePlugin(urls);
223+
export function configureAxePlugin(
224+
urls: PluginUrls,
225+
options?: AxePluginOptions,
226+
): CoreConfig {
227+
const axe = axePlugin(urls, options);
222228
return {
223229
plugins: [axe],
224230
categories: [

e2e/plugin-axe-e2e/mocks/fixtures/default-setup/code-pushup.config.ts renamed to e2e/plugin-axe-e2e/mocks/fixtures/code-pushup.config.ts

File renamed without changes.
File renamed without changes.

e2e/plugin-axe-e2e/tests/collect.e2e.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,23 @@ import { nxTargetProject } from '@code-pushup/test-nx-utils';
77
import {
88
E2E_ENVIRONMENTS_DIR,
99
TEST_OUTPUT_DIR,
10+
restoreNxIgnoredFiles,
1011
teardownTestFolder,
1112
} from '@code-pushup/test-utils';
1213
import { executeProcess, readJsonFile } from '@code-pushup/utils';
1314

1415
describe('PLUGIN collect report with axe-plugin NPM package', () => {
16+
const fixturesDir = path.join('e2e', nxTargetProject(), 'mocks', 'fixtures');
1517
const testFileDir = path.join(
1618
E2E_ENVIRONMENTS_DIR,
1719
nxTargetProject(),
1820
TEST_OUTPUT_DIR,
1921
'collect',
2022
);
21-
const defaultSetupDir = path.join(testFileDir, 'default-setup');
22-
const fixturesDir = path.join('e2e', nxTargetProject(), 'mocks', 'fixtures');
2323

2424
beforeAll(async () => {
2525
await cp(fixturesDir, testFileDir, { recursive: true });
26+
await restoreNxIgnoredFiles(testFileDir);
2627
});
2728

2829
afterAll(async () => {
@@ -33,13 +34,13 @@ describe('PLUGIN collect report with axe-plugin NPM package', () => {
3334
const { code } = await executeProcess({
3435
command: 'npx',
3536
args: ['@code-pushup/cli', 'collect'],
36-
cwd: defaultSetupDir,
37+
cwd: testFileDir,
3738
});
3839

3940
expect(code).toBe(0);
4041

41-
const report: Report = await readJsonFile(
42-
path.join(defaultSetupDir, '.code-pushup', 'report.json'),
42+
const report = await readJsonFile<Report>(
43+
path.join(testFileDir, '.code-pushup', 'report.json'),
4344
);
4445

4546
expect(() => reportSchema.parse(report)).not.toThrow();

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"wrap-ansi": "^9.0.2",
4646
"yaml": "^2.5.1",
4747
"yargs": "^17.7.2",
48-
"zod": "^4.0.5"
48+
"zod": "^4.2.1"
4949
},
5050
"devDependencies": {
5151
"@actions/core": "^1.11.1",

packages/ci/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"glob": "^11.0.1",
3434
"simple-git": "^3.20.0",
3535
"yaml": "^2.5.1",
36-
"zod": "^4.0.5"
36+
"zod": "^4.2.1"
3737
},
3838
"files": [
3939
"src",

packages/models/docs/models-reference.md

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

packages/models/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"dependencies": {
3030
"ansis": "^3.3.2",
3131
"vscode-material-icons": "^0.1.0",
32-
"zod": "^4.0.5"
32+
"zod": "^4.2.1"
3333
},
3434
"files": [
3535
"src",

packages/models/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,4 @@ export {
166166
type Tree,
167167
} from './lib/tree.js';
168168
export { uploadConfigSchema, type UploadConfig } from './lib/upload-config.js';
169+
export { convertAsyncZodFunctionToSchema } from './lib/implementation/function.js';

0 commit comments

Comments
 (0)