@wdio/utils 8.0.0-alpha.518 → 8.0.0-alpha.547

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":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,aAAa,CAAA;AAQpD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE;IAAE,sBAAsB,CAAC,EAAE;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,QAsCzH;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,UA+BrE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAE,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;EAapF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,WA8B/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAE,GAAG,EAAE,GAAG,wGAExC;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,CA2BtF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAE,EAAE,EAAE,QAAQ,WAE5C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAE,IAAI,EAAE,GAAG,EAAE,SAE1C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,WAanC;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,YAWtC,CAAA;A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@
1
1
  import fs from 'node:fs';
2
+ import path from 'node:path';
2
3
  import { pathToFileURL } from 'node:url';
3
4
  import { createRequire } from 'node:module';
4
5
  const require = createRequire(import.meta.url);
@@ -158,12 +159,27 @@ export async function safeImport(name) {
158
159
  * also allows to link the package to a random place and have plugins
159
160
  * imported correctly (for dev purposes).
160
161
  */
162
+ const localNodeModules = path.join(process.cwd(), 'node_modules');
161
163
  /* istanbul ignore if */
162
- if (require.resolve) {
163
- requirePath = await require.resolve(name);
164
- if (!requirePath.startsWith('file://')) {
165
- requirePath = pathToFileURL(requirePath).href;
166
- }
164
+ if (!require.resolve.paths(name)?.includes(localNodeModules)) {
165
+ const resolveLocation = [
166
+ ...(require.resolve.paths(name) || []),
167
+ localNodeModules
168
+ ];
169
+ /**
170
+ * don't set requireOpts when running unit tests as it
171
+ * confuses Jest require magic
172
+ */
173
+ const requireOpts = process.env.VITEST_WORKER_ID
174
+ ? {}
175
+ : { paths: resolveLocation };
176
+ requirePath = require.resolve(name, requireOpts);
177
+ }
178
+ else {
179
+ requirePath = require.resolve(name);
180
+ }
181
+ if (!requirePath.startsWith('file://')) {
182
+ requirePath = pathToFileURL(requirePath).href;
167
183
  }
168
184
  }
169
185
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wdio/utils",
3
- "version": "8.0.0-alpha.518+af6190801",
3
+ "version": "8.0.0-alpha.547+d26292ec1",
4
4
  "description": "A WDIO helper utility to provide several utility functions used across the project.",
5
5
  "author": "Christian Bromann <mail@bromann.dev>",
6
6
  "homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-utils",
@@ -27,12 +27,12 @@
27
27
  "url": "https://github.com/webdriverio/webdriverio/issues"
28
28
  },
29
29
  "dependencies": {
30
- "@wdio/logger": "8.0.0-alpha.518+af6190801",
31
- "@wdio/types": "8.0.0-alpha.518+af6190801",
30
+ "@wdio/logger": "8.0.0-alpha.547+d26292ec1",
31
+ "@wdio/types": "8.0.0-alpha.547+d26292ec1",
32
32
  "p-iteration": "^1.1.8"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "af6190801a0ec74c6799cc993e512aecf5846c4c"
37
+ "gitHead": "d26292ec1ea19fde65d2b575a7cb3ef288231ad2"
38
38
  }