Skip to content

ci: add e2e tests to CI #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 12, 2025
Merged
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
46 changes: 45 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
test:
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
name: Test / Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -67,3 +67,47 @@ jobs:
node-version: 'lts/*'
- run: npm install
- run: npm run typecheck

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- run: npm install
- run: npm run build
- name: Upload build results
uses: actions/upload-artifact@v4
with:
name: build_dist
path: dist
e2e:
name: E2E / Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version:
- '24.0.0' # minimum supported v24
- 24
- '22.13.1' # minimum supported v22
- 22
- '20.19.0' #minimum supported v20
- 20
os:
- ubuntu-latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we may be missing tests on Windows. Should we test that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can add that. Do you want it added to the unit test matrix too?

Copy link
Contributor Author

@michaelfaith michaelfaith Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the e2e job. If you want me to add it to the test job, I can do that too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally would be good to test on both. Hopefully it doesn't hurt perf too much. Also could be done separately.

- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Download build results
uses: actions/download-artifact@v4
with:
name: build_dist
path: dist
- run: npm install
- run: npm run e2e
1 change: 1 addition & 0 deletions .npmpackagejsonlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e2e/
1 change: 1 addition & 0 deletions e2e/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock = false
15 changes: 15 additions & 0 deletions e2e/fixtures/all-typed-config/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'eslint/config';

import eslintPlugin from 'eslint-plugin-eslint-plugin';

export default defineConfig([
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
{
extends: [eslintPlugin.configs.all],
files: ['./index.js', './rule.js'],
},
]);
25 changes: 25 additions & 0 deletions e2e/fixtures/all-typed-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import rule from './rule.js';

/** @type {import('eslint').ESLint.Plugin} */
const plugin = {
meta: {
name: '@e2e/all-typed-config',
version: '1.0.0',
},
rules: { 'e2e-test': rule },
configs: {
recommended: {
name: '@e2e/all-typed-config/recommended',
plugins: {
get ['@e2e/all-typed-config']() {
return plugin;
},
},
rules: {
'@e2e/all-typed-config/e2e-test': 'error',
},
},
},
};

export default plugin;
15 changes: 15 additions & 0 deletions e2e/fixtures/all-typed-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@e2e/all-typed-config",
"private": true,
"type": "module",
"scripts": {
"lint": "tsc && eslint"
},
"main": "./index.js",
"devDependencies": {
"eslint": "^9.33.0",
"eslint-plugin-eslint-plugin": "file:../../..",
"jiti": "^2.5.1",
"typescript": "^5.9.2"
}
}
32 changes: 32 additions & 0 deletions e2e/fixtures/all-typed-config/rule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/** @type {import('eslint').Rule.RuleModule} */
const rule = {
// eslint-disable-next-line eslint-plugin/require-meta-schema
meta: {
type: 'suggestion',
docs: {
description: 'enforce a test',
recommended: false,
url: 'https://test.org',
},
fixable: undefined, // or "code" or "whitespace"
messages: {
missingOutput: 'This is a test',
},
},

create(context) {
return {
Program(ast) {
const sourceCode = context.sourceCode;
if (false) {
context.report({
node: ast,
messageId: 'missingOutput',
});
}
},
};
},
};

export default rule;
15 changes: 15 additions & 0 deletions e2e/fixtures/all-typed-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"rootDir": ".",
"module": "nodenext",
"moduleResolution": "nodenext",
"noEmit": true,
"skipLibCheck": true,
"strict": true,
"target": "ES2024",
"verbatimModuleSyntax": true,
"erasableSyntaxOnly": true,
"types": []
},
"include": ["eslint.config.ts"]
}
15 changes: 15 additions & 0 deletions e2e/fixtures/all/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'eslint/config';

import eslintPlugin from 'eslint-plugin-eslint-plugin';

export default defineConfig([
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
{
extends: [eslintPlugin.configs.all],
files: ['./index.js', './rule.js'],
},
]);
25 changes: 25 additions & 0 deletions e2e/fixtures/all/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import rule from './rule.js';

/** @type {import('eslint').ESLint.Plugin} */
const plugin = {
meta: {
name: '@e2e/all',
version: '1.0.0',
},
rules: { 'e2e-test': rule },
configs: {
recommended: {
name: '@e2e/all/recommended',
plugins: {
get ['@e2e/all']() {
return plugin;
},
},
rules: {
'@e2e/all/e2e-test': 'error',
},
},
},
};

export default plugin;
13 changes: 13 additions & 0 deletions e2e/fixtures/all/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@e2e/all",
"private": true,
"type": "module",
"scripts": {
"lint": "eslint"
},
"main": "./index.js",
"devDependencies": {
"eslint": "^9.33.0",
"eslint-plugin-eslint-plugin": "file:../../.."
}
}
32 changes: 32 additions & 0 deletions e2e/fixtures/all/rule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/** @type {import('eslint').Rule.RuleModule} */
const rule = {
// eslint-disable-next-line eslint-plugin/require-meta-schema
meta: {
type: 'suggestion',
docs: {
description: 'enforce a test',
recommended: false,
url: 'https://test.org',
},
fixable: undefined, // or "code" or "whitespace"
messages: {
missingOutput: 'This is a test',
},
},

create(context) {
return {
Program(ast) {
const sourceCode = context.sourceCode;
if (false) {
context.report({
node: ast,
messageId: 'missingOutput',
});
}
},
};
},
};

export default rule;
Loading
Loading