Repository navigation
Conversation
The styles test suite uses the jsdom environment, but jsdom was not a dependency, so no tests could run. Add it as a devDependency. The EdsTokens test failed because vitest resolves styled-components' Node build (via `module`), which only emits global styles during SSR. Alias styled-components to its browser build in the vitest config so client-side style injection reaches the jsdom DOM. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
There was a problem hiding this comment.
🟢 Approval recommended
The missing jsdom dependency and browser-oriented styled-components alias address the identified Vitest setup issues without changing published runtime output.
No open issues 🎉
What changed in this PR
This maintenance pull request restores the packages/styles Vitest suite by adding the missing jsdom dependency and resolving styled-components to its browser build so global styles render correctly in jsdom.
Changes:
- Add
jsdomas a development dependency. - Alias
styled-componentsto its browser ESM build for Vitest. - Update
bun.lockwith the dependency graph. - No published runtime output changes.
| File | Description |
|---|---|
packages/styles/vitest.config.ts |
Configures the browser-oriented styled-components build for jsdom tests. |
packages/styles/package.json |
Adds jsdom as a development dependency. |
bun.lock |
Records the new dependency and its transitive packages. |
Review effort: Lite
Component Development
Type
Reference to assignment
Description of assignment
Why: The
@equinor/fusion-react-stylestest suite could not run onmain:vitest.config.tsuses thejsdomenvironment, butjsdomwas not installed (MISSING DEPENDENCY Cannot find dependency 'jsdom'). Once installed,EdsTokens - CSS Variables Renderingfailed because no<style>tags were injected.Description of Proposed Changes
What:
jsdomas a devDependency ofpackages/styles(viabun add -d jsdom;bun.lockupdated by bun).styled-componentsto its browser ESM build inpackages/styles/vitest.config.ts. Vitest resolves the Node build (modulefield), which only renders global styles during SSR; client-side injection only exists in thebrowser-field build, socreateGlobalStylenever reached the jsdom DOM.Validation:
bunx vitest run(packages/styles): 56 passed / 0 failed (before: suite could not start; with jsdom only: 55 passed / 1 failed)bunx biome check packages/styles/vitest.config.ts packages/styles/package.json: no findingsChecklist
Create User Story(DevOps) or Issue(Github)
Development
Create Pull Request
Review of Pull Request
Publish Code