@stencil/vitest 1.8.1 → 1.8.3

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.
@@ -10,6 +10,7 @@ function parseArgs(argv) {
10
10
  verbose: false,
11
11
  debug: false,
12
12
  prod: false,
13
+ build: false,
13
14
  coverage: false,
14
15
  noCoverage: false,
15
16
  ui: false,
@@ -57,6 +58,36 @@ function parseArgs(argv) {
57
58
  parsed.prod = true;
58
59
  i++;
59
60
  break;
61
+ case '--build':
62
+ parsed.build = true;
63
+ i++;
64
+ break;
65
+ // Handle --no-<flag> variants of Stencil boolean flags
66
+ // Stencil dynamically supports negating any boolean flag with the no- prefix
67
+ case '--no-watch':
68
+ parsed.watch = false;
69
+ i++;
70
+ break;
71
+ case '--no-serve':
72
+ parsed.serve = false;
73
+ i++;
74
+ break;
75
+ case '--no-verbose':
76
+ parsed.verbose = false;
77
+ i++;
78
+ break;
79
+ case '--no-debug':
80
+ parsed.debug = false;
81
+ i++;
82
+ break;
83
+ case '--no-prod':
84
+ parsed.prod = false;
85
+ i++;
86
+ break;
87
+ case '--no-build':
88
+ parsed.build = false;
89
+ i++;
90
+ break;
60
91
  // Vitest flags
61
92
  case '--project':
62
93
  if (!parsed.project)
@@ -1 +1 @@
1
- {"version":3,"file":"stencil.d.ts","sourceRoot":"","sources":["../../src/environments/stencil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiBvD,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;CACrD;AAQD;;;;;;;;;;;;;;;;GAgBG;wBACa,WAAW;AAA3B,wBAmEE"}
1
+ {"version":3,"file":"stencil.d.ts","sourceRoot":"","sources":["../../src/environments/stencil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiBvD,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;CACrD;AAQD;;;;;;;;;;;;;;;;GAgBG;wBACa,WAAW;AAA3B,wBAwEE"}
@@ -46,14 +46,19 @@ export default {
46
46
  }
47
47
  // Setup the environment and get the window
48
48
  const { window: win, teardown: envTeardown } = await environment(global, options);
49
- // Stub MessageEvent on global before populateGlobal to prevent Node's undici from loading
50
- // This prevents "Class extends value undefined" errors from undici's WebSocket implementation
51
- if (!global.MessageEvent && win.MessageEvent) {
52
- Object.defineProperty(global, 'MessageEvent', {
53
- value: win.MessageEvent,
54
- writable: true,
55
- configurable: true,
56
- });
49
+ // Stub globals on global before populateGlobal to prevent Node's undici from loading.
50
+ // When populateGlobal accesses these globals, Node lazily loads them from undici,
51
+ // which has a bug in Node 20.x where WebSocket extends undefined EventTarget.
52
+ // By pre-stubbing these with the window's versions, we prevent the undici load.
53
+ const globalsToStub = ['MessageEvent', 'FormData', 'Headers', 'Request', 'Response', 'WebSocket'];
54
+ for (const key of globalsToStub) {
55
+ if (!global[key] && win[key]) {
56
+ Object.defineProperty(global, key, {
57
+ value: win[key],
58
+ writable: true,
59
+ configurable: true,
60
+ });
61
+ }
57
62
  }
58
63
  // Set NODE_ENV to test if not already set
59
64
  if (!win.process?.env) {
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.8.1",
7
+ "version": "1.8.3",
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.8.1"
103
+ "vitest-environment-stencil": "1.8.3"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@eslint/js": "^9.39.2",