Skip to content

Commit c01a6f4

Browse files
authored
chore(ci): record which unit tests a change reaches, without skipping any (#10593)
Adds @useblacksmith/vitest to the apps/sim unit run in CI in shadow mode. Each run records what every test file loads and logs how many files a selecting run would have skipped, while still running every test. Nothing about what runs changes; the logs are the evidence for deciding whether to let PR runs skip unaffected tests.
1 parent cdc542b commit c01a6f4

3 files changed

Lines changed: 57 additions & 1 deletion

File tree

‎apps/sim/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@
340340
"@types/react-dom": "^19",
341341
"@types/ssh2": "^1.15.6",
342342
"@types/yauzl": "3.4.0",
343+
"@useblacksmith/vitest": "0.7.0",
343344
"@vitejs/plugin-react": "^6.2.1",
344345
"@vitest/coverage-v8": "^5.1.0",
345346
"@vitest/expect": "5.1.0",

‎apps/sim/vitest.config.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from 'path'
2+
import blacksmith from '@useblacksmith/vitest'
23
import react from '@vitejs/plugin-react'
34
import { defineConfig, mergeConfig } from 'vitest/config'
45
import sharedConfig, { integrationTestConfig } from '../../vitest.shared'
@@ -19,11 +20,18 @@ export default defineConfig(({ mode }) => {
1920
const integration = mode === 'integration'
2021
const live = mode === 'live'
2122
if (!integration) loadEnvConfig(process.cwd())
23+
/**
24+
* Test selection on trial: in CI the unit run records what each test file loads and logs how
25+
* many files a selecting run would have skipped, while still running every test. Shadow mode
26+
* changes nothing about what runs; selection is a separate decision once the logs show it
27+
* never skips a test a change could break.
28+
*/
29+
const recordTestSelection = mode === 'test' && process.env.GITHUB_ACTIONS === 'true'
2230

2331
return mergeConfig(
2432
integration ? mergeConfig(sharedConfig, integrationTestConfig) : sharedConfig,
2533
{
26-
plugins: [react()],
34+
plugins: [react(), ...(recordTestSelection ? [blacksmith({ shadow: true })] : [])],
2735
/**
2836
* Skip PostCSS entirely. Loading the Tailwind config for a `.module.css`
2937
* import costs ~150ms per test file that reaches an emcn component, and no

‎bun.lock‎

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)