@stencil/vitest 1.1.3 → 1.1.4

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":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAOlE,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,GAAE,cAAc,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;CAAO,GACvE,OAAO,CAAC,cAAc,CAAC,CAqBzB"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAOlE,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,GAAE,cAAc,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,GAAG,aAAa,CAAA;CAAO,GACvE,OAAO,CAAC,cAAc,CAAC,CAqBzB"}
package/dist/config.js CHANGED
@@ -1,5 +1,9 @@
1
+ import { fileURLToPath } from 'node:url';
1
2
  import { defineConfig } from 'vitest/config';
2
3
  import { loadStencilConfig, getStencilSrcDir, getStencilOutputDirs, getStencilResolveAliases, } from './setup/config-loader.js';
4
+ // Resolve the path to the stencil environment module at config load time
5
+ // This is necessary for pnpm which doesn't hoist transitive dependencies
6
+ const stencilEnvironmentPath = fileURLToPath(import.meta.resolve('@stencil/vitest/environments/stencil'));
3
7
  /**
4
8
  * Define a Vitest configuration for Stencil component testing
5
9
  *
@@ -131,12 +135,21 @@ function applyStencilDefaults(config, stencilConfig) {
131
135
  if (!result.resolve) {
132
136
  result.resolve = {};
133
137
  }
138
+ // Always add alias for vitest-environment-stencil to resolve from this package
139
+ // This is necessary for pnpm which doesn't hoist transitive dependencies
140
+ const environmentAlias = {
141
+ 'vitest-environment-stencil': stencilEnvironmentPath,
142
+ };
134
143
  if (!result.resolve.alias) {
135
- result.resolve.alias = getStencilResolveAliases(stencilConfig);
144
+ result.resolve.alias = {
145
+ ...environmentAlias,
146
+ ...getStencilResolveAliases(stencilConfig),
147
+ };
136
148
  }
137
149
  else if (typeof result.resolve.alias === 'object' && !Array.isArray(result.resolve.alias)) {
138
150
  // Merge with existing aliases, user's aliases take precedence
139
151
  result.resolve.alias = {
152
+ ...environmentAlias,
140
153
  ...getStencilResolveAliases(stencilConfig),
141
154
  ...result.resolve.alias,
142
155
  };
@@ -242,6 +255,11 @@ function applyStencilDefaults(config, stencilConfig) {
242
255
  */
243
256
  function enhanceTestConfig(testConfig, stencilConfig) {
244
257
  const enhanced = { ...testConfig };
258
+ // Rewrite 'stencil' environment to use the actual path
259
+ // This is necessary for pnpm which doesn't hoist transitive dependencies
260
+ if (enhanced.environment?.toLowerCase() === 'stencil') {
261
+ enhanced.environment = stencilEnvironmentPath;
262
+ }
245
263
  // Get output directories from Stencil config
246
264
  const outputDirs = getStencilOutputDirs(stencilConfig);
247
265
  const defaultExcludes = ['**/node_modules/**', ...outputDirs.map((dir) => `**/${dir}/**`)];
@@ -295,10 +313,15 @@ function enhanceProject(project, stencilConfig) {
295
313
  ...existingExcludes.filter((pattern) => !defaultExcludes.includes(pattern)),
296
314
  ];
297
315
  }
316
+ // Rewrite 'stencil' environment to use the actual path
317
+ // This is necessary for pnpm which doesn't hoist transitive dependencies
318
+ const environment = enhanced.test.environment?.toLowerCase();
319
+ if (environment === 'stencil') {
320
+ enhanced.test.environment = stencilEnvironmentPath;
321
+ }
298
322
  // Auto-inject setup files based on environment
299
323
  const setupFiles = enhanced.test.setupFiles || [];
300
324
  const setupFilesArray = Array.isArray(setupFiles) ? setupFiles : [setupFiles];
301
- const environment = enhanced.test.environment?.toLowerCase();
302
325
  // Auto-inject setup files based on environment type
303
326
  // This provides automatic polyfills based on the environment being used
304
327
  // Auto-inject jsdom-setup for jsdom environment
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.1.3",
7
+ "version": "1.1.4",
8
8
  "description": "First-class testing utilities for Stencil design systems with Vitest",
9
9
  "license": "MIT",
10
10
  "type": "module",
@@ -92,7 +92,7 @@
92
92
  "dependencies": {
93
93
  "jiti": "^2.6.1",
94
94
  "local-pkg": "^1.1.2",
95
- "vitest-environment-stencil": "1.1.3"
95
+ "vitest-environment-stencil": "1.1.4"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@eslint/js": "^9.39.2",