@stencil/vitest 1.8.2 → 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.
|
@@ -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,
|
|
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
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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.
|
|
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.
|
|
103
|
+
"vitest-environment-stencil": "1.8.3"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@eslint/js": "^9.39.2",
|