Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions code-pushup.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dotenv/config';
import {
axeCoreConfig,
coverageCoreConfigNx,
eslintCoreConfigNx,
jsDocsCoreConfig,
Expand Down Expand Up @@ -43,4 +44,7 @@ export default mergeConfigs(
'!**/implementation/**',
'!**/internal/**',
]),
axeCoreConfig(
'https://github.com/code-pushup/cli?tab=readme-ov-file#code-pushup-cli/',
),
);
9 changes: 7 additions & 2 deletions code-pushup.preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import type {
CategoryConfig,
CoreConfig,
PluginUrls,
} from './packages/models/src/index.js';
import axePlugin from './packages/plugin-axe/src/index.js';
import coveragePlugin, {
getNxCoveragePaths,
} from './packages/plugin-coverage/src/index.js';
Expand All @@ -20,7 +22,6 @@ import {
} from './packages/plugin-jsdocs/src/lib/constants.js';
import { filterGroupsByOnlyAudits } from './packages/plugin-jsdocs/src/lib/utils.js';
import lighthousePlugin, {
type LighthouseUrls,
lighthouseGroupRef,
mergeLighthouseCategories,
} from './packages/plugin-lighthouse/src/index.js';
Expand Down Expand Up @@ -137,7 +138,7 @@ export const jsPackagesCoreConfig = async (): Promise<CoreConfig> => ({
});

export const lighthouseCoreConfig = async (
urls: LighthouseUrls,
urls: PluginUrls,
): Promise<CoreConfig> => {
const lhPlugin = await lighthousePlugin(urls);
return {
Expand Down Expand Up @@ -216,3 +217,7 @@ export const coverageCoreConfigNx = async (
categories: coverageCategories,
};
};

export const axeCoreConfig = (urls: PluginUrls): CoreConfig => ({
plugins: [axePlugin(urls)],
});
12 changes: 12 additions & 0 deletions e2e/plugin-axe-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import tseslint from 'typescript-eslint';
import baseConfig from '../../eslint.config.js';

export default tseslint.config(...baseConfig, {
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
import axePlugin from '@code-pushup/axe-plugin';
import type { CoreConfig } from '@code-pushup/models';

const htmlFile = join(process.cwd(), 'index.html');
const url = pathToFileURL(htmlFile).href;

export default {
plugins: [axePlugin(url)],
} satisfies CoreConfig;
44 changes: 44 additions & 0 deletions e2e/plugin-axe-e2e/mocks/fixtures/default-setup/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Accessibility Test Page</title>
<style>
/* Poor color contrast for testing */
.low-contrast {
color: #777;
background-color: #999;
padding: 10px;
}
</style>
</head>
<body>
<h1>Accessibility Test Page</h1>

<!-- Missing alt text on image -->
<img src="test-image.jpg" width="200" height="150" />

<!-- Poor color contrast -->
<div class="low-contrast">
This text has poor color contrast and may be hard to read.
</div>

<!-- Invalid ARIA attribute -->
<div role="button" aria-invalid-attribute="true">
Button with invalid ARIA attribute
</div>

<!-- Form input missing label -->
<form>
<input type="text" name="username" placeholder="Enter username" />
<button type="submit">Submit</button>
</form>

<!-- Button without accessible name -->
<button></button>

<!-- Link without accessible name -->
<a href="#"></a>
</body>
</html>
17 changes: 17 additions & 0 deletions e2e/plugin-axe-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "plugin-axe-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "e2e/plugin-axe-e2e/src",
"projectType": "application",
"targets": {
"lint": {},
"e2e": {
"executor": "@nx/vite:test",
"options": {
"configFile": "{projectRoot}/vitest.e2e.config.ts"
}
}
},
"implicitDependencies": ["cli", "plugin-axe"],
"tags": ["scope:plugin", "type:e2e"]
}
Loading
Loading