Skip to content

chore: Generate visual test definitions barrel file automatically - #4998

Draft
jperals wants to merge 5 commits into
mainfrom
dev-v3-jotresse-visual-tests-no-index
Draft

chore: Generate visual test definitions barrel file automatically#4998
jperals wants to merge 5 commits into
mainfrom
dev-v3-jotresse-visual-tests-no-index

Conversation

@jperals

@jperals jperals commented Sep 11, 2026

Copy link
Copy Markdown
Member

Description

Autogenerate the barrel file test/definitions/index.ts so that in order to add new visual regression tests we only need to add files to test/definitions/visual, and there is no risk of forgetting to update test/definitions/index.ts.

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jperals
jperals force-pushed the dev-v3-jotresse-visual-tests-no-index branch from 1cc0ea3 to d399841 Compare September 11, 2026 10:25
@jperals jperals changed the title Dev v3 jotresse visual tests no index chore: Generate visual test definitions barrel file automatically Sep 11, 2026
@codecov

codecov Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.66%. Comparing base (9dbfdb2) to head (15d2b77).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4998   +/-   ##
=======================================
  Coverage   97.66%   97.66%           
=======================================
  Files         960      960           
  Lines       31368    31368           
  Branches    11593    11593           
=======================================
  Hits        30637    30637           
  Misses        685      685           
  Partials       46       46           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical export regressions must be fixed, and the contributor workflow documentation should be updated.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Automates generation of the visual test definitions barrel during the test-definitions build.

Changes:

  • Removes the manually maintained barrel.
  • Adds JavaScript and TypeScript barrel generation.
  • Runs generation after compilation and registers the task.
File summaries
File Summary
test/definitions/index.ts Removes the manual barrel file.
build-tools/tasks/test-definitions.js Chains compilation with generation; contributor documentation should be updated.
build-tools/tasks/index.js Registers the generator task.
build-tools/tasks/generate-test-definitions-index.js Generates grouped exports; must preserve dropdownAlignment and the existing allSuites export.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread build-tools/tasks/generate-test-definitions-index.js Outdated
Comment on lines +65 to +66
componentLines.push(`const ${exportName} = [${suites}];`);
componentLines.push(`exports.${exportName} = ${exportName};`);
Comment on lines +13 to +15
// Compile the definitions, then generate the barrel index (lib/test-definitions/index.js)
// from the files in test/definitions/visual so it does not need to be maintained by hand.
module.exports = series(compile, generateTestDefinitionsIndex);

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Preserve the existing grouped exports and allSuites to avoid a breaking API change.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

function generateIndexJs(definitions) {
const lines = definitions.map(file => {
const exportName = toCamelCase(file);
return `exports.${exportName} = require('./visual/${file}').default;`;
mxschll and others added 2 commits September 11, 2026 17:43
Co-authored-by: Maximilian Schoell <mxschll@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants