feat(ci): diagram-scoped e2e test selection#7619
Conversation
|
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7619 +/- ##
==========================================
- Coverage 3.32% 3.31% -0.01%
==========================================
Files 537 540 +3
Lines 56477 56675 +198
Branches 822 824 +2
==========================================
+ Hits 1879 1880 +1
- Misses 54598 54795 +197
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
knsv
left a comment
There was a problem hiding this comment.
One change we should think about. We could do that in a separate PR but that one should not wait too long.
|
Also check the linting |
Move all diagram-specific Cypress specs from the flat cypress/integration/rendering/ directory into per-diagram subfolders (e.g. cypress/integration/rendering/flowchart/). The detection script now uses filesystem discovery instead of a hardcoded DIAGRAM_SPEC_MAP: it checks whether cypress/integration/rendering/<diagram-name>/ exists and returns a glob pattern (cypress/integration/rendering/<name>/**) as the --spec argument. Adding a new spec to a subfolder requires zero config changes. Cross-cutting specs (theme, conf-and-directives, shapes, etc.) remain at the root of cypress/integration/rendering/ and continue to trigger the full suite. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntion Any spec file at the root of cypress/integration/rendering/ is treated as cross-cutting (full suite). Any spec in a subfolder is scoped to that subfolder. No explicit list to maintain — the directory position is the convention. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@pbrolin47, Thank you for the contribution! |
Summary
Resolves #7593
scripts/e2e-diagram-scope.mjs— a pure Node.js ESM detection engine that reads changed file paths and emits only the matching Cypress--specpattern (or an empty string to trigger the full suite)scripts/run-e2e-scoped.ts— local dev runner that diffs HEAD vs a base ref and spawns Cypress with the scoped spec listscripts/e2e-diagram-scope.spec.ts— 14 unit tests covering all classification paths (single diagram, shared code, unknown diagram, multi-diagram, cross-cutting specs)pnpmscripts:e2e:scope,e2e:scope:harness,e2e:scope:run,e2e:scope:detectdetect-scopeCI job that runs in parallel withcache(no critical-path penalty), uses a dynamic matrix ([1]when scoped,[1,2,3,4,5]for the full suite), and passes thespec:filter tocypress-io/github-actionClassification
E2E_SCOPE_BY_DIAGRAM) defaults tofalse; existing behavior is fully preserved until the flag is enabledHow to enable
Set a repository variable in GitHub → Settings → Secrets and variables → Actions → Variables:
When enabled, a PR that only touches (e.g.)
packages/mermaid/src/diagrams/flowchart/will run onlycypress/integration/rendering/flowchart/flowchart*.spec.*in a single container instead of the full 5-container suite.Any change to shared code (
rendering-util/,themes/,config,diagram-api/,parser/, etc.) falls back automatically to the full suite.Verification
scripts/e2e-diagram-scope.spec.ts) — run withvitest run scripts/e2e-diagram-scopepnpm lintlocallyNote for testing locally:
In your local repo, do changes locally. Then you can issue command
git status --short | awk '{print $2}' | node scripts/e2e-diagram-scope.mjsIf an empty string is will result in the full e2e-suite will be run in CI, otherwise specific diagram folders will be returned
For testing locally together with cypress, you can use the steps below:
🤖 Generated with Claude Code