@testgorilla/eslint-plugin-e2e
v0.1.2
Published
TestGorilla e2e test conventions: tag enforcement, JIRA ticket validation (cross-repo aware), triage-tag exclusivity. Extracted from tgo-qa-automation's eslint-plugin-custom for reuse by repos that collocate their e2e suites.
Readme
@testgorilla/eslint-plugin-e2e
TestGorilla e2e test conventions as a publishable ESLint plugin, extracted from
tgo-qa-automation's in-repo eslint-plugin-custom so repos that collocate their e2e
suites (starting with tgo-backend) enforce the same review-blocking rules. Design:
docs/e2e-test-collocation-plan.md §4.6.2.
Rules
| Rule | Enforces |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| require-tag-in-tests | Every test/test.skip has a tag array whose entries start with @, including at least one valid JIRA ticket. Project prefixes are bundled; override via the projects option. |
| validate-test-case-tickets | JIRA tickets are unique across tests. With the externalTicketsFile option, uniqueness extends across repos: the file is a manifest of tickets used elsewhere (see below). |
| exclusive-triage-tags | At most one of @needs-triage / @skipped / @flaky. |
// .eslintrc.js
plugins: ['@testgorilla/e2e'],
rules: {
'@testgorilla/e2e/require-tag-in-tests': 'error',
'@testgorilla/e2e/exclusive-triage-tags': 'error',
'@testgorilla/e2e/validate-test-case-tickets':
['error', { externalTicketsFile: './.jira-tickets.external.json' }],
},Cross-repo ticket manifests
collect-jira-tickets (shipped as a bin) scans *.spec.ts files and writes a
manifest of { ticket, repo, file, line } entries (@XXX-0000 placeholders are
exempt):
npx collect-jira-tickets --repo tgo-backend --src e2e/tests --out .jira-tickets.jsonEach repo checks in the other repos' manifest as .jira-tickets.external.json
for lint-time feedback; a nightly CI job runs the collector on all repos and fails
on intersection (the authoritative check — lint-time is eventually consistent).
Differences from eslint-plugin-custom
jira-projects.jsonand the ticket-pattern helper are bundled (the old plugin reached outside its directory intohelpers/jira).projectsandexternalTicketsFileare rule options.- Ships
collect-jira-tickets.
tgo-qa-automation uses this plugin as its active lint plugin (file:-installed
from the workspace); eslint-plugin-custom has been retired (QA-3745).
Develop
npm test --workspace @testgorilla/eslint-plugin-e2e # RuleTester suite