From 994c36d896c6b971dedfef397507d4b5e2809dc4 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Sun, 25 Oct 2026 18:29:14 -0400 Subject: [PATCH] chore(test): document the Vitest project split Keep node for main/shared and happy-dom for preload/renderer; benchmark shows the environment is only ~2% of suite time and vmThreads is required for Primer CSS. Exclude Markdown from coverage. --- vitest.config.mts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vitest.config.mts b/vitest.config.mts index 369ea8a03..2ec3fef93 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -17,6 +17,8 @@ export default defineConfig({ plugins: [react()], test: { globals: true, + // happy-dom tests import CSS from @primer/react. The threads and forks pools + // cannot load those .css files (ERR_UNKNOWN_FILE_EXTENSION), so keep vmThreads. pool: 'vmThreads', isolate: true, attachmentsDir: '.vitest-attachments', @@ -43,8 +45,10 @@ export default defineConfig({ reportOnFailure: true, reporter: ['html', 'lcovonly'], include: ['src/**/*'], - exclude: ['**/*.html', '**/*.graphql', '**/graphql/generated/**', '**/.DS_Store'], + exclude: ['**/*.html', '**/*.md', '**/*.graphql', '**/graphql/generated/**', '**/.DS_Store'], }, + // Projects mirror the runtime boundary: Node for main/shared, happy-dom for + // preload/renderer, and a real browser for pixel tests. projects: [ { extends: true, @@ -65,7 +69,10 @@ export default defineConfig({ }, }, { - // TODO - Opportunity in future to move some of the renderer util tests to node environment + // Renderer tests stay in happy-dom even when they look like pure utils: + // many touch window.gitify, localStorage, navigator, document, or Audio, + // and the environment is only ~2% of suite runtime. A third node project + // would still need a renderer setup and would not remove that coupling. extends: true, test: { name: 'node [main, shared]',