@stencil/vitest 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,28 @@ import { spawn } from 'child_process';
3
3
  import { existsSync, unlinkSync, writeFileSync } from 'fs';
4
4
  import { extname, join } from 'path';
5
5
  import { createJiti } from 'jiti';
6
+ /**
7
+ * Creates a clean environment for spawning npm/npx commands.
8
+ * Filters out pnpm-specific npm_config_* variables that npm doesn't recognize,
9
+ * which cause warnings like "Unknown env config" in npm 10+.
10
+ */
11
+ function getCleanNpmEnv(extraEnv = {}) {
12
+ const pnpmOnlyConfigs = new Set([
13
+ 'npm_config_npm-globalconfig',
14
+ 'npm_config_verify-deps-before-run',
15
+ 'npm_config_catalog',
16
+ 'npm_config__jsr-registry',
17
+ 'npm_config_only-built-dependencies',
18
+ 'npm_globalconfig_only-built-dependencies',
19
+ ]);
20
+ const cleanEnv = {};
21
+ for (const [key, value] of Object.entries(process.env)) {
22
+ if (!pnpmOnlyConfigs.has(key)) {
23
+ cleanEnv[key] = value;
24
+ }
25
+ }
26
+ return { ...cleanEnv, ...extraEnv };
27
+ }
6
28
  function parseArgs(argv) {
7
29
  const parsed = {
8
30
  watch: false,
@@ -235,14 +257,13 @@ function runTests() {
235
257
  cwd,
236
258
  stdio: 'inherit',
237
259
  shell: true,
238
- env: {
239
- ...process.env,
260
+ env: getCleanNpmEnv({
240
261
  NODE_ENV: 'test',
241
262
  // Expose CLI flags to tests via environment variables
242
263
  STENCIL_PROD: args.prod ? 'true' : '',
243
264
  STENCIL_SERVE: args.serve ? 'true' : '',
244
265
  STENCIL_PORT: args.port || '',
245
- },
266
+ }),
246
267
  });
247
268
  vitestProcess.on('exit', (code) => {
248
269
  isRunningTests = false;
@@ -631,6 +652,7 @@ process.on('SIGTERM', () => cleanup());
631
652
  stencilProcess = spawn('npx', stencilArgs, {
632
653
  cwd,
633
654
  shell: true,
655
+ env: getCleanNpmEnv(),
634
656
  });
635
657
  // Pipe stdout and watch for build completion
636
658
  stencilProcess.stdout?.on('data', handleStencilOutput);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/stenciljs/vitest"
6
6
  },
7
- "version": "1.9.1",
7
+ "version": "1.9.2",
8
8
  "description": "First-class testing utilities for Stencil design systems with Vitest",
9
9
  "license": "MIT",
10
10
  "type": "module",
@@ -100,7 +100,7 @@
100
100
  "dependencies": {
101
101
  "jiti": "^2.6.1",
102
102
  "local-pkg": "^1.1.2",
103
- "vitest-environment-stencil": "1.9.1"
103
+ "vitest-environment-stencil": "1.9.2"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@eslint/js": "^9.39.2",