-
Notifications
You must be signed in to change notification settings - Fork 235
chore(barebones): improve infrastructure and testing setup #5811
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
base: barebones
Are you sure you want to change the base?
Conversation
|
📚 Branch Preview🔍 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Tachometer resultsCurrently, no packages are changed by this PR... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were using vite at the moment because the web-dev-server was not working without the current updated exports from the core nor the process.env resolution. Now it is no longer needed so we are restoring the previous behaviour (that you still find on main.
| const json = fromRollup(rollupJson); | ||
|
|
||
| // Custom plugin to replace process.env.NODE_ENV in all files | ||
| const replaceProcessEnv = () => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The web-dev-server does not automatically pass the process.env resolution to the imported modules, so we need this middleware to manually handle it.
| } | ||
| return SizedElement; | ||
| } | ||
| export * from '@swc/core/shared/base/sizedMixin.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had forgotten to re-export this from 2nd-gen, now that it is there :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Becausesecond-gen/ is being served outside of the root of the first-gen/ project, web-test-runner would not be able to correctly resolve the path and collect the coverage. Patching this fixes it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after yarn workspace @adobe/spectrum-web-components test:focus unit --config web-test-runner.config.ci-chromium.js --coverage:
tools/truncated/test/truncated.test.js:
🚧 Browser logs:
TypeError: Failed to fetch dynamically imported module: https://localhost:8000/tools/truncated/test/truncated.test.js?wtr-session-id=b5Cx2rMCcbUL8Vm3FUCcw
❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information.
Description
This PR includes several infrastructure improvements and fixes to improve the DX across first-gen and second-gen. I kept the commit history fairly specific so you can follow each improvement "step by step".
process.env.NODE_ENVreplacement plugin that was preventing the dev server from starting__wds-outside-root__file paths, to allow coverage to be collected for second-gen core base classes imported via alias in first-gen testsMotivation and context
process.env.NODE_ENVreplacement causing runtime errors (e.g.window.__swcwould not be defined) and import/export inconsistencies when resolving second-gen dependencies.@swc/core/*alias), the files are served with__wds-outside-root__URL prefixes. The coverage tool attempted to resolve these paths by naively joining them with the root directory, creating invalid paths like:The patch detects this special URL pattern and correctly resolves to:
This enables proper coverage collection and reporting for second-gen source files (via source maps) when tested through first-gen test suites.
Related issue(s)
bareboneseffortsScreenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
first-gen/yarn workspace @adobe/spectrum-web-components test:focus unit --config web-test-runner.config.ci-chromium.js --coverage)first-gen/coverage/lcov-report/index.htmlsecond-gen/packages/core/components/*entries in the coverage report__wds-outside-root__paths in the test outputyarn storybookinsidesecond-gen/packages/swc/)mainStorybook state)