Files
zooqueenandHanzo Dev 6d9eff143f CI has been red for a day on a race between two copies of one build
ci.yml has failed on every push since 2026-08-05 — twenty runs — and the cause
was two test files each running src/build.js into the same dist/, gated on
DIFFERENT sentinels: output-root.test.ts checked for the directory,
webextension-polyfill.test.ts checked for a file inside it. vitest runs files in
parallel, the directory appears the instant the slower build starts, so the
faster suite skipped its own build and asserted against a tree still being
written. It failed 'chrome: expected false to be true' in 12ms — too fast to
have built anything, which is the tell.

The build is a fixture the suite needs, not something a test conjures, so it now
happens once in globalSetup before parallelism starts and the assertions go back
to being assertions. Requiring EVERY artifact, not just one, means an
interrupted run rebuilds instead of being mistaken for a finished one — the same
confusion between started and done that caused the race.

Verified from a deleted dist/: 24 files, 302/302. Locally this suite had been
reporting 22 files/292 tests off a stale dist — the two build-driving files
never ran — which is why it looked green here while CI was red.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-06 05:39:43 -07:00

28 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vitest/config';
/**
* The answer surface mounts REAL @hanzo/ui (on @hanzo/gui), so the runner needs
* the same web resolution the build uses — react-native → react-native-web,
* react-native-svg stubbed (its CommonJS re-requires ESM, which Node refuses),
* and the @hanzogui/* family inlined so the provider and the components share
* ONE theme module instance. Same recipe as @hanzo/ui's own render suites.
*/
export default defineConfig({
css: { postcss: { plugins: [] } },
resolve: {
alias: [
{ find: /^react-native-svg(\/.*)?$/, replacement: new URL('./tests/react-native-svg.stub.ts', import.meta.url).pathname },
{ find: /^react-native$/, replacement: 'react-native-web' },
],
},
test: {
exclude: ['e2e/**', 'node_modules/**'],
setupFiles: ['./tests/vitest.setup.ts'],
// The bundle suites need a built dist/. Once, here, before the files run in
// parallel — two of them used to build it themselves and raced. See
// tests/built-dist.ts.
globalSetup: ['./tests/built-dist.ts'],
server: { deps: { inline: [/@hanzogui\//, /@hanzo\/gui/, /@hanzo\/ui/, /react-native/] } },
},
});