@wdio/browser-runner 8.13.8 → 8.13.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.
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -0
- package/build/vite/frameworks/index.d.ts +1 -2
- package/build/vite/frameworks/index.d.ts.map +1 -1
- package/build/vite/frameworks/index.js +2 -2
- package/build/vite/frameworks/nuxt.d.ts +1 -2
- package/build/vite/frameworks/nuxt.d.ts.map +1 -1
- package/build/vite/frameworks/nuxt.js +13 -14
- package/build/vite/server.d.ts.map +1 -1
- package/build/vite/server.js +0 -10
- package/package.json +2 -2
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAO5C,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAO5C,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAU/G,OAAO,KAAK,EAAE,oBAAoB,IAAI,0BAA0B,EAAmB,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAK5H,MAAM,CAAC,OAAO,OAAO,aA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KAAK,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC;CACd,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AACvB,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE;IACxC,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC;CAChB,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC5B,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE;IACxC,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,IAAI,CAAC;CACd,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import libSourceMap from 'istanbul-lib-source-maps';
|
|
|
10
10
|
import reports from 'istanbul-reports';
|
|
11
11
|
import { ViteServer } from './vite/server.js';
|
|
12
12
|
import { FRAMEWORK_SUPPORT_ERROR, SESSIONS, BROWSER_POOL, DEFAULT_COVERAGE_REPORTS, SUMMARY_REPORTER, DEFAULT_REPORTS_DIRECTORY } from './constants.js';
|
|
13
|
+
import updateViteConfig from './vite/frameworks/index.js';
|
|
13
14
|
import { makeHeadless, getCoverageByFactor, adjustWindowInWatchMode } from './utils.js';
|
|
14
15
|
const log = logger('@wdio/browser-runner');
|
|
15
16
|
export default class BrowserRunner extends LocalRunner {
|
|
@@ -54,6 +55,15 @@ export default class BrowserRunner extends LocalRunner {
|
|
|
54
55
|
await fs.rm(this.#reportsDirectory, { recursive: true });
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* make adjustments based on detected frontend frameworks
|
|
60
|
+
*/
|
|
61
|
+
try {
|
|
62
|
+
await updateViteConfig(this.#options, this.#config);
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
log.error(`Failed to optimize Vite config: ${err.stack}`);
|
|
66
|
+
}
|
|
57
67
|
await super.initialise();
|
|
58
68
|
}
|
|
59
69
|
async run(runArgs) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { InlineConfig } from 'vite';
|
|
2
1
|
import type { Options } from '@wdio/types';
|
|
3
|
-
export default function updateViteConfig(
|
|
2
|
+
export default function updateViteConfig(options: WebdriverIO.BrowserRunnerOptions, config: Options.Testrunner): Promise<void>;
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/frameworks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite/frameworks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAI1C,wBAA8B,gBAAgB,CAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,iBAKpH"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isNuxtFramework, optimizeForNuxt } from './nuxt.js';
|
|
2
|
-
export default async function updateViteConfig(
|
|
2
|
+
export default async function updateViteConfig(options, config) {
|
|
3
3
|
const isNuxt = await isNuxtFramework(config.rootDir || process.cwd());
|
|
4
4
|
if (isNuxt) {
|
|
5
|
-
await optimizeForNuxt(
|
|
5
|
+
await optimizeForNuxt(options, config);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { InlineConfig } from 'vite';
|
|
2
1
|
import type { Options } from '@wdio/types';
|
|
3
2
|
declare global {
|
|
4
3
|
var defineNuxtConfig: Function;
|
|
5
4
|
}
|
|
6
5
|
export declare function isNuxtFramework(rootDir: string): Promise<boolean>;
|
|
7
|
-
export declare function optimizeForNuxt(
|
|
6
|
+
export declare function optimizeForNuxt(options: WebdriverIO.BrowserRunnerOptions, config: Options.Testrunner): Promise<void>;
|
|
8
7
|
//# sourceMappingURL=nuxt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nuxt.d.ts","sourceRoot":"","sources":["../../../src/vite/frameworks/nuxt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nuxt.d.ts","sourceRoot":"","sources":["../../../src/vite/frameworks/nuxt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAK1C,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,gBAAgB,EAAE,QAAQ,CAAA;CACjC;AAID,wBAAsB,eAAe,CAAE,OAAO,EAAE,MAAM,oBAOrD;AAED,wBAAsB,eAAe,CAAE,OAAO,EAAE,WAAW,CAAC,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU,iBAkC3G"}
|
|
@@ -8,23 +8,17 @@ export async function isNuxtFramework(rootDir) {
|
|
|
8
8
|
hasFile(path.join(rootDir, '.nuxt'))
|
|
9
9
|
])).filter(Boolean).length > 0;
|
|
10
10
|
}
|
|
11
|
-
export async function optimizeForNuxt(
|
|
12
|
-
const rootDir = config.rootDir || process.cwd();
|
|
13
|
-
const nuxtConfigPath = await getNuxtConfig(rootDir);
|
|
14
|
-
if (!nuxtConfigPath) {
|
|
15
|
-
throw new Error('No Nuxt project found!');
|
|
16
|
-
}
|
|
17
|
-
globalThis.defineNuxtConfig = (opts) => opts;
|
|
18
|
-
const nuxtConfig = (await import(nuxtConfigPath)).default;
|
|
11
|
+
export async function optimizeForNuxt(options, config) {
|
|
19
12
|
const Unimport = (await import('unimport/unplugin')).default;
|
|
20
13
|
const { scanDirExports } = await import('unimport');
|
|
21
|
-
const {
|
|
22
|
-
const
|
|
23
|
-
|
|
14
|
+
const { loadNuxtConfig } = await import('@nuxt/kit');
|
|
15
|
+
const rootDir = config.rootDir || process.cwd();
|
|
16
|
+
const nuxtOptions = await loadNuxtConfig({ rootDir });
|
|
17
|
+
if (nuxtOptions.imports?.autoImport === false) {
|
|
24
18
|
return;
|
|
25
19
|
}
|
|
26
20
|
const composablesDirs = [];
|
|
27
|
-
for (const layer of
|
|
21
|
+
for (const layer of nuxtOptions._layers) {
|
|
28
22
|
composablesDirs.push(path.resolve(layer.config.srcDir, 'composables'));
|
|
29
23
|
composablesDirs.push(path.resolve(layer.config.srcDir, 'utils'));
|
|
30
24
|
for (const dir of (layer.config.imports?.dirs ?? [])) {
|
|
@@ -35,11 +29,16 @@ export async function optimizeForNuxt(viteConfig, options, config) {
|
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
31
|
const composableImports = await scanDirExports(composablesDirs);
|
|
38
|
-
viteConfig.
|
|
32
|
+
options.viteConfig = options.viteConfig || {};
|
|
33
|
+
const viteConfig = (options.viteConfig || {});
|
|
34
|
+
if (!Array.isArray(viteConfig.plugins)) {
|
|
35
|
+
viteConfig.plugins = [];
|
|
36
|
+
}
|
|
37
|
+
viteConfig.plugins.push(Unimport.vite({
|
|
39
38
|
presets: ['vue'],
|
|
40
39
|
imports: composableImports
|
|
41
40
|
}));
|
|
42
|
-
log.info(`Optimized Vite config for Nuxt project
|
|
41
|
+
log.info(`Optimized Vite config for Nuxt project at ${rootDir}`);
|
|
43
42
|
}
|
|
44
43
|
async function getNuxtConfig(rootDir) {
|
|
45
44
|
const pathOptions = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAGpC,OAAO,KAAK,EAAiB,YAAY,EAAa,MAAM,MAAM,CAAA;AAGlE,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/vite/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAM1C,OAAO,EAAE,eAAe,EAAE,MAAM,IAAI,CAAA;AAGpC,OAAO,KAAK,EAAiB,YAAY,EAAa,MAAM,MAAM,CAAA;AAGlE,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,aAAa,CAAA;AAQpD,OAAO,KAAK,EACM,gBAAgB,EAEjC,MAAM,YAAY,CAAA;AAgBnB,qBAAa,UAAW,SAAQ,YAAY;;IAUxC,IAAI,YAAY,gCAEf;IAED,IAAI,MAAM,0BAET;gBAEY,OAAO,EAAE,WAAW,CAAC,oBAAoB,EAAE,MAAM,EAAE,OAAO,CAAC,UAAU;IA2B5E,KAAK;IAsDL,KAAK;IA2IX,OAAO,CAAC,cAAc;IAetB,WAAW,CAAE,MAAM,EAAE,gBAAgB;CAUxC"}
|
package/build/vite/server.js
CHANGED
|
@@ -8,7 +8,6 @@ import { serializeError } from 'serialize-error';
|
|
|
8
8
|
import { executeHooksWithArgs } from '@wdio/utils';
|
|
9
9
|
import { createServer } from 'vite';
|
|
10
10
|
import istanbulPlugin from 'vite-plugin-istanbul';
|
|
11
|
-
import updateViteConfig from './frameworks/index.js';
|
|
12
11
|
import { testrunner } from './plugins/testrunner.js';
|
|
13
12
|
import { mockHoisting } from './plugins/mockHoisting.js';
|
|
14
13
|
import { userfriendlyImport } from './utils.js';
|
|
@@ -101,15 +100,6 @@ export class ViteServer extends EventEmitter {
|
|
|
101
100
|
*/
|
|
102
101
|
this.#wss = new WebSocketServer({ port: wssPort });
|
|
103
102
|
this.#wss.on('connection', this.#onConnect.bind(this));
|
|
104
|
-
/**
|
|
105
|
-
* make adjustments based on detected frontend frameworks
|
|
106
|
-
*/
|
|
107
|
-
try {
|
|
108
|
-
await updateViteConfig(this.#viteConfig, this.#options, this.#config);
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
log.error(`Failed to optimize Vite config: ${err.stack}`);
|
|
112
|
-
}
|
|
113
103
|
/**
|
|
114
104
|
* initialize Vite
|
|
115
105
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/browser-runner",
|
|
3
|
-
"version": "8.13.
|
|
3
|
+
"version": "8.13.9",
|
|
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",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"@types/ws": "^8.5.4",
|
|
74
74
|
"@wdio/runner": "8.13.4"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "1785f113f436eba9ae73b25c5d26389769f9d035"
|
|
77
77
|
}
|