mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
test(frontend): verify global stylesheet @import graph after vitest
Add scripts/check-css-import-graph.mjs and run it from npm test and test:coverage so missing relative CSS imports fail CI like Vite/postcss. Document the step in src/test/README.md; trigger frontend workflow when the script changes.
This commit is contained in:
@@ -33,8 +33,21 @@ src/test/
|
||||
npm test # one-shot run
|
||||
npm run test:watch # watch mode
|
||||
npm run test:coverage # with v8 coverage → ./coverage/
|
||||
npm run check:css-imports # only the global stylesheet @import graph (see below)
|
||||
```
|
||||
|
||||
## CSS `@import` graph
|
||||
|
||||
Vitest does not load the full global CSS bundle from `main.tsx`, so a broken
|
||||
relative `@import` under `src/styles/**` can slip past the suite until Vite
|
||||
runs (`ENOENT` from postcss-import).
|
||||
|
||||
After **`vitest run`**, **`npm test`** and **`npm run test:coverage`** run
|
||||
**`npm run check:css-imports`**, which executes **`scripts/check-css-import-graph.mjs`**
|
||||
and walks the same four root stylesheets as **`src/main.tsx`**, resolving
|
||||
only filesystem-relative imports (`./…`, `../…`). Package imports such as
|
||||
`@fontsource/...` are ignored.
|
||||
|
||||
## Where tests go
|
||||
|
||||
- **Co-located with the unit under test**: `Foo.tsx` → `Foo.test.tsx`,
|
||||
|
||||
Reference in New Issue
Block a user