@wdio/browser-runner 8.15.9 → 8.16.0

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":"mockHoisting.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/mockHoisting.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAU7C,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CA4U/D"}
1
+ {"version":3,"file":"mockHoisting.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/mockHoisting.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAU7C,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE,CAgV/D"}
@@ -167,8 +167,10 @@ export function mockHoisting(mockHandler) {
167
167
  (source.startsWith('.') &&
168
168
  [...sessionMocks.values()].find((m) => {
169
169
  const fileImportPath = path.resolve(path.dirname(id), source);
170
+ const fileImportPathSliced = fileImportPath.slice(0, path.extname(fileImportPath).length * -1);
170
171
  const testMockPath = path.resolve(path.dirname(spec || '/'), m);
171
- return fileImportPath.slice(0, path.extname(fileImportPath).length * -1) === testMockPath.slice(0, path.extname(testMockPath).length * -1);
172
+ const testMockPathSliced = testMockPath.slice(0, path.extname(testMockPath).length * -1);
173
+ return fileImportPathSliced === testMockPathSliced && fileImportPathSliced.length > 0;
172
174
  })));
173
175
  /**
174
176
  * add to import map if module is mocked and imported in the test file
@@ -190,8 +192,10 @@ export function mockHoisting(mockHandler) {
190
192
  const newNode = b.importDeclaration([b.importNamespaceSpecifier(b.identifier(newImportIdentifier))], b.literal(source));
191
193
  nodePath.insertBefore(newNode);
192
194
  }
195
+ // determine file extension length so we can cut it out, fall back to infinity if no extension is set
196
+ const mockExtensionLengh = (path.extname(source).length * -1) || Infinity;
193
197
  const wdioImportModuleIdentifier = source.startsWith('.') || source.startsWith('/')
194
- ? url.pathToFileURL(path.resolve(path.dirname(id), source).slice(0, path.extname(source).length * -1)).pathname
198
+ ? url.pathToFileURL(path.resolve(path.dirname(id), source).slice(0, mockExtensionLengh)).pathname
195
199
  : source;
196
200
  const isNamespaceImport = dec.specifiers.length === 1 && dec.specifiers[0].type === types.namedTypes.ImportNamespaceSpecifier.toString();
197
201
  const mockImport = isSpecFile && !isMockedModule
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/browser-runner",
3
- "version": "8.15.9",
3
+ "version": "8.16.0",
4
4
  "description": "A WebdriverIO runner to run unit tests tests in the browser.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browser-runner",
@@ -35,13 +35,13 @@
35
35
  "@types/istanbul-lib-source-maps": "^4.0.1",
36
36
  "@types/node": "^20.1.0",
37
37
  "@vitest/spy": "^0.34.1",
38
- "@wdio/globals": "8.15.9",
39
- "@wdio/local-runner": "8.15.9",
38
+ "@wdio/globals": "8.16.0",
39
+ "@wdio/local-runner": "8.16.0",
40
40
  "@wdio/logger": "8.11.0",
41
- "@wdio/mocha-framework": "8.15.9",
41
+ "@wdio/mocha-framework": "8.16.0",
42
42
  "@wdio/protocols": "8.14.6",
43
- "@wdio/types": "8.15.7",
44
- "@wdio/utils": "8.15.9",
43
+ "@wdio/types": "8.15.10",
44
+ "@wdio/utils": "8.16.0",
45
45
  "ast-types": "^0.14.2",
46
46
  "deepmerge-ts": "^5.0.0",
47
47
  "expect-webdriverio": "^4.2.5",
@@ -60,8 +60,8 @@
60
60
  "vite": "~4.4.6",
61
61
  "vite-plugin-istanbul": "^5.0.0",
62
62
  "vite-plugin-top-level-await": "^1.3.0",
63
- "webdriver": "8.15.9",
64
- "webdriverio": "8.15.9",
63
+ "webdriver": "8.16.0",
64
+ "webdriverio": "8.16.0",
65
65
  "ws": "^8.13.0"
66
66
  },
67
67
  "scripts": {
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "devDependencies": {
74
74
  "@types/ws": "^8.5.4",
75
- "@wdio/runner": "8.15.9"
75
+ "@wdio/runner": "8.16.0"
76
76
  },
77
- "gitHead": "86eec4b2a71da7dcfaa0f021db32c8035e0ff06a"
77
+ "gitHead": "69af55a5cd2aa1f1e4173b2fa2c28a7d65ceca83"
78
78
  }