Skip to content

Commit f251ba9

Browse files
kazuponfengmk2
andauthored
chore(tools): suppress Node.js warnings in snap tests for stable output (#1070)
Add `NODE_NO_WARNINGS=1` to the snap test environment to suppress Node.js runtime warnings (e.g. `MODULE_TYPELESS_PACKAGE_JSON`) that vary across Node.js versions. ## Why? Without this, developers using a different Node.js version than the one pinned in `.node-version` (22.18.0) will see warnings in stderr that get captured into snap output, causing false diffs unrelated to actual code changes. Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
1 parent 78cb0e2 commit f251ba9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/tools/src/snap-test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ async function runTestCase(name: string, tempTmpDir: string, casesDir: string, b
245245
// Indicate CLI is running in test mode, so that it prints more detailed outputs.
246246
// Also disables tips for stable snapshots.
247247
VITE_PLUS_CLI_TEST: '1',
248+
// Suppress Node.js runtime warnings (e.g. MODULE_TYPELESS_PACKAGE_JSON)
249+
// to keep snap outputs stable across Node.js versions.
250+
NODE_NO_WARNINGS: '1',
248251
NO_COLOR: 'true',
249252
// set CI=true make sure snap-tests are stable on GitHub Actions
250253
CI: 'true',

0 commit comments

Comments
 (0)