@stencil/vitest 1.1.7 → 1.1.9

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,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from 'child_process';
3
3
  import { existsSync, unlinkSync, writeFileSync } from 'fs';
4
- import { join } from 'path';
4
+ import { extname, join } from 'path';
5
5
  import { createJiti } from 'jiti';
6
6
  function parseArgs(argv) {
7
7
  const parsed = {
@@ -388,15 +388,22 @@ async function createTemporaryStencilConfig(userSpecifiedConfig, vitestConfigPat
388
388
  };
389
389
  // Create temp file as sibling of stencil.config so tsconfig.json can be found
390
390
  // Stencil looks for tsconfig.json relative to the config file location
391
- const tempConfigPath = join(cwd, `.stencil-test-${Date.now()}.config.mjs`);
391
+ const ext = extname(userConfigPath);
392
+ const tempConfigPath = join(cwd, `.stencil-test-${Date.now()}.config${ext}`);
392
393
  // Serialize the config - convert RegExp objects to strings for the output
393
394
  const patternsArray = mergedConfig.watchIgnoredRegex.map((pattern) => pattern.toString()).join(',\n ');
394
- // Generate a simple config with user config import
395
+ /**
396
+ * Generate a simple config with user config import.
397
+ *
398
+ * JSON.stringify for normalize path between windows and unix.
399
+ * Windows: "C:\xxx\yyy" -> "C:\\xxx\\yyy"
400
+ * Unix: "C:/xxx/yyy" -> "C:/xxx/yyy"
401
+ */
395
402
  const tempConfigContent = `
396
403
  // Auto-generated temporary config by stencil-test
397
404
  // This extends your stencil config and adds watchIgnoredRegex for screenshot files
398
405
 
399
- import ${userConfig.config ? '{ config as baseConfig }' : 'baseConfig'} from '${userConfigPath}';
406
+ import ${userConfig.config ? '{ config as baseConfig }' : 'baseConfig'} from ${JSON.stringify(userConfigPath)};
400
407
 
401
408
  export const config = {
402
409
  ...baseConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/testing/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,aAAa,CAAC;AAE1D,UAAU,aAAa;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAKD;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,GAAG,GAAG,EACvE,KAAK,EAAE,GAAG,EACV,OAAO,GAAE,aAGR,GACA,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CA8H7B"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/testing/render.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAY,MAAM,aAAa,CAAC;AAE1D,UAAU,aAAa;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAKD;;GAEG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAAE,CAAC,GAAG,GAAG,EACvE,KAAK,EAAE,GAAG,EACV,OAAO,GAAE,aAGR,GACA,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAkI7B"}
@@ -75,9 +75,13 @@ export async function render(vnode, options = {
75
75
  container.remove();
76
76
  };
77
77
  const spyOnEvent = (eventName) => {
78
- // Return existing spy if already created
79
- if (eventSpies.has(container)) {
80
- return eventSpies.get(container).find((spy) => spy.eventName === eventName);
78
+ // Return existing spy if already created for this specific event
79
+ const existingSpies = eventSpies.get(container);
80
+ if (existingSpies) {
81
+ const existingSpy = existingSpies.find((spy) => spy.eventName === eventName);
82
+ if (existingSpy) {
83
+ return existingSpy;
84
+ }
81
85
  }
82
86
  const spy = {
83
87
  eventName,
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.7",
7
+ "version": "1.1.9",
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.7"
95
+ "vitest-environment-stencil": "1.1.9"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@eslint/js": "^9.39.2",