@nuxt/test-utils 3.14.0 → 3.14.1
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/dist/config.d.mts +38 -32
- package/dist/config.d.ts +38 -32
- package/dist/config.mjs +4 -0
- package/dist/e2e.d.mts +2 -3
- package/dist/e2e.d.ts +2 -3
- package/dist/e2e.mjs +4 -4
- package/dist/experimental.mjs +1 -1
- package/dist/module.mjs +2 -2
- package/dist/playwright.d.mts +1 -2
- package/dist/playwright.d.ts +1 -2
- package/dist/playwright.mjs +2 -2
- package/dist/shared/{test-utils.CSumGjP7.mjs → test-utils.BZS9cHDP.mjs} +1 -1
- package/dist/shared/{test-utils.iUoJhWDR.mjs → test-utils.BumFEtZ8.mjs} +4 -1
- package/dist/shared/{test-utils.Bfk23aTC.d.mts → test-utils.CyoO8zI7.d.mts} +39 -2
- package/dist/shared/{test-utils.Bfk23aTC.d.ts → test-utils.CyoO8zI7.d.ts} +39 -2
- package/package.json +23 -23
package/dist/config.d.mts
CHANGED
|
@@ -18,40 +18,46 @@ declare function getVitestConfigFromNuxt(options?: GetVitestConfigOptions, loadN
|
|
|
18
18
|
declare function defineVitestConfig(config?: InlineConfig & {
|
|
19
19
|
test?: InlineConfig$1;
|
|
20
20
|
}): vite.UserConfig & Promise<vite.UserConfig> & (vite.UserConfigFnObject & vite.UserConfigExport);
|
|
21
|
+
interface NuxtEnvironmentOptions {
|
|
22
|
+
rootDir?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The starting URL for your Nuxt window environment
|
|
25
|
+
* @default {http://localhost:3000}
|
|
26
|
+
*/
|
|
27
|
+
url?: string;
|
|
28
|
+
/**
|
|
29
|
+
* You can define how environment options are read when loading the Nuxt configuration.
|
|
30
|
+
*/
|
|
31
|
+
dotenv?: Partial<DotenvOptions>;
|
|
32
|
+
/**
|
|
33
|
+
* Configuration that will override the values in your `nuxt.config` file.
|
|
34
|
+
*/
|
|
35
|
+
overrides?: NuxtConfig;
|
|
36
|
+
/**
|
|
37
|
+
* The id of the root div to which the app should be mounted. You should also set `app.rootId` to the same value.
|
|
38
|
+
* @default {nuxt-test}
|
|
39
|
+
*/
|
|
40
|
+
rootId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The name of the DOM environment to use.
|
|
43
|
+
*
|
|
44
|
+
* It also needs to be installed as a dev dependency in your project.
|
|
45
|
+
* @default {happy-dom}
|
|
46
|
+
*/
|
|
47
|
+
domEnvironment?: 'happy-dom' | 'jsdom';
|
|
48
|
+
mock?: {
|
|
49
|
+
intersectionObserver?: boolean;
|
|
50
|
+
indexedDb?: boolean;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
declare module 'vitest/node' {
|
|
54
|
+
interface EnvironmentOptions {
|
|
55
|
+
nuxt?: NuxtEnvironmentOptions;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
21
58
|
declare module 'vitest' {
|
|
22
59
|
interface EnvironmentOptions {
|
|
23
|
-
nuxt?:
|
|
24
|
-
rootDir?: string;
|
|
25
|
-
/**
|
|
26
|
-
* The starting URL for your Nuxt window environment
|
|
27
|
-
* @default {http://localhost:3000}
|
|
28
|
-
*/
|
|
29
|
-
url?: string;
|
|
30
|
-
/**
|
|
31
|
-
* You can define how environment options are read when loading the Nuxt configuration.
|
|
32
|
-
*/
|
|
33
|
-
dotenv?: Partial<DotenvOptions>;
|
|
34
|
-
/**
|
|
35
|
-
* Configuration that will override the values in your `nuxt.config` file.
|
|
36
|
-
*/
|
|
37
|
-
overrides?: NuxtConfig;
|
|
38
|
-
/**
|
|
39
|
-
* The id of the root div to which the app should be mounted. You should also set `app.rootId` to the same value.
|
|
40
|
-
* @default {nuxt-test}
|
|
41
|
-
*/
|
|
42
|
-
rootId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* The name of the DOM environment to use.
|
|
45
|
-
*
|
|
46
|
-
* It also needs to be installed as a dev dependency in your project.
|
|
47
|
-
* @default {happy-dom}
|
|
48
|
-
*/
|
|
49
|
-
domEnvironment?: 'happy-dom' | 'jsdom';
|
|
50
|
-
mock?: {
|
|
51
|
-
intersectionObserver?: boolean;
|
|
52
|
-
indexedDb?: boolean;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
60
|
+
nuxt?: NuxtEnvironmentOptions;
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
package/dist/config.d.ts
CHANGED
|
@@ -18,40 +18,46 @@ declare function getVitestConfigFromNuxt(options?: GetVitestConfigOptions, loadN
|
|
|
18
18
|
declare function defineVitestConfig(config?: InlineConfig & {
|
|
19
19
|
test?: InlineConfig$1;
|
|
20
20
|
}): vite.UserConfig & Promise<vite.UserConfig> & (vite.UserConfigFnObject & vite.UserConfigExport);
|
|
21
|
+
interface NuxtEnvironmentOptions {
|
|
22
|
+
rootDir?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The starting URL for your Nuxt window environment
|
|
25
|
+
* @default {http://localhost:3000}
|
|
26
|
+
*/
|
|
27
|
+
url?: string;
|
|
28
|
+
/**
|
|
29
|
+
* You can define how environment options are read when loading the Nuxt configuration.
|
|
30
|
+
*/
|
|
31
|
+
dotenv?: Partial<DotenvOptions>;
|
|
32
|
+
/**
|
|
33
|
+
* Configuration that will override the values in your `nuxt.config` file.
|
|
34
|
+
*/
|
|
35
|
+
overrides?: NuxtConfig;
|
|
36
|
+
/**
|
|
37
|
+
* The id of the root div to which the app should be mounted. You should also set `app.rootId` to the same value.
|
|
38
|
+
* @default {nuxt-test}
|
|
39
|
+
*/
|
|
40
|
+
rootId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The name of the DOM environment to use.
|
|
43
|
+
*
|
|
44
|
+
* It also needs to be installed as a dev dependency in your project.
|
|
45
|
+
* @default {happy-dom}
|
|
46
|
+
*/
|
|
47
|
+
domEnvironment?: 'happy-dom' | 'jsdom';
|
|
48
|
+
mock?: {
|
|
49
|
+
intersectionObserver?: boolean;
|
|
50
|
+
indexedDb?: boolean;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
declare module 'vitest/node' {
|
|
54
|
+
interface EnvironmentOptions {
|
|
55
|
+
nuxt?: NuxtEnvironmentOptions;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
21
58
|
declare module 'vitest' {
|
|
22
59
|
interface EnvironmentOptions {
|
|
23
|
-
nuxt?:
|
|
24
|
-
rootDir?: string;
|
|
25
|
-
/**
|
|
26
|
-
* The starting URL for your Nuxt window environment
|
|
27
|
-
* @default {http://localhost:3000}
|
|
28
|
-
*/
|
|
29
|
-
url?: string;
|
|
30
|
-
/**
|
|
31
|
-
* You can define how environment options are read when loading the Nuxt configuration.
|
|
32
|
-
*/
|
|
33
|
-
dotenv?: Partial<DotenvOptions>;
|
|
34
|
-
/**
|
|
35
|
-
* Configuration that will override the values in your `nuxt.config` file.
|
|
36
|
-
*/
|
|
37
|
-
overrides?: NuxtConfig;
|
|
38
|
-
/**
|
|
39
|
-
* The id of the root div to which the app should be mounted. You should also set `app.rootId` to the same value.
|
|
40
|
-
* @default {nuxt-test}
|
|
41
|
-
*/
|
|
42
|
-
rootId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* The name of the DOM environment to use.
|
|
45
|
-
*
|
|
46
|
-
* It also needs to be installed as a dev dependency in your project.
|
|
47
|
-
* @default {happy-dom}
|
|
48
|
-
*/
|
|
49
|
-
domEnvironment?: 'happy-dom' | 'jsdom';
|
|
50
|
-
mock?: {
|
|
51
|
-
intersectionObserver?: boolean;
|
|
52
|
-
indexedDb?: boolean;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
60
|
+
nuxt?: NuxtEnvironmentOptions;
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
package/dist/config.mjs
CHANGED
|
@@ -44,6 +44,10 @@ async function startNuxtAndGetViteConfig(rootDir = process.cwd(), options = {})
|
|
|
44
44
|
cwd: rootDir,
|
|
45
45
|
fileName: ".env.test"
|
|
46
46
|
}),
|
|
47
|
+
defaults: {
|
|
48
|
+
// suppress compatibility date warning for runtime environment tests
|
|
49
|
+
compatibilityDate: "2024-04-03"
|
|
50
|
+
},
|
|
47
51
|
overrides: defu(
|
|
48
52
|
{
|
|
49
53
|
appId: "nuxt-app",
|
package/dist/e2e.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.
|
|
2
|
-
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.
|
|
1
|
+
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.CyoO8zI7.mjs';
|
|
2
|
+
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.CyoO8zI7.mjs';
|
|
3
3
|
import { LogType } from 'consola';
|
|
4
4
|
import 'playwright-core';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
6
|
import 'execa';
|
|
7
|
-
import 'nitropack';
|
|
8
7
|
|
|
9
8
|
declare function createTestContext(options: Partial<TestOptions>): TestContext;
|
|
10
9
|
declare function useTestContext(): TestContext;
|
package/dist/e2e.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.
|
|
2
|
-
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.
|
|
1
|
+
import { T as TestOptions, a as TestContext, b as TestHooks } from './shared/test-utils.CyoO8zI7.js';
|
|
2
|
+
export { $ as $fetch, G as GotoOptions, S as StartServerOptions, h as TestRunner, c as createBrowser, d as createPage, f as fetch, g as getBrowser, s as startServer, e as stopServer, u as url, w as waitForHydration } from './shared/test-utils.CyoO8zI7.js';
|
|
3
3
|
import { LogType } from 'consola';
|
|
4
4
|
import 'playwright-core';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
6
|
import 'execa';
|
|
7
|
-
import 'nitropack';
|
|
8
7
|
|
|
9
8
|
declare function createTestContext(options: Partial<TestOptions>): TestContext;
|
|
10
9
|
declare function useTestContext(): TestContext;
|
package/dist/e2e.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as distDir } from './shared/test-utils.
|
|
2
|
-
export { b as buildFixture, c as createBrowser, a as createPage, e as createTest, g as getBrowser, l as loadFixture, f as setup, s as setupMaps, w as waitForHydration } from './shared/test-utils.
|
|
3
|
-
import { u as useTestContext } from './shared/test-utils.
|
|
4
|
-
export { $ as $fetch, c as createTestContext, e as exposeContextToEnv, f as fetch, i as isDev, r as recoverContextFromEnv, s as setTestContext, a as startServer, b as stopServer, d as url } from './shared/test-utils.
|
|
1
|
+
import { d as distDir } from './shared/test-utils.BZS9cHDP.mjs';
|
|
2
|
+
export { b as buildFixture, c as createBrowser, a as createPage, e as createTest, g as getBrowser, l as loadFixture, f as setup, s as setupMaps, w as waitForHydration } from './shared/test-utils.BZS9cHDP.mjs';
|
|
3
|
+
import { u as useTestContext } from './shared/test-utils.BumFEtZ8.mjs';
|
|
4
|
+
export { $ as $fetch, c as createTestContext, e as exposeContextToEnv, f as fetch, i as isDev, r as recoverContextFromEnv, s as setTestContext, a as startServer, b as stopServer, d as url } from './shared/test-utils.BumFEtZ8.mjs';
|
|
5
5
|
import { consola } from 'consola';
|
|
6
6
|
import { resolve } from 'pathe';
|
|
7
7
|
import 'node:fs';
|
package/dist/experimental.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'pathe';
|
|
2
2
|
import { stringifyQuery } from 'ufo';
|
|
3
|
-
import { $ as $fetch, u as useTestContext } from './shared/test-utils.
|
|
3
|
+
import { $ as $fetch, u as useTestContext } from './shared/test-utils.BumFEtZ8.mjs';
|
|
4
4
|
import 'execa';
|
|
5
5
|
import 'get-port-please';
|
|
6
6
|
import 'ofetch';
|
package/dist/module.mjs
CHANGED
|
@@ -35,7 +35,7 @@ const createMockPlugin = (ctx) => createUnplugin(() => {
|
|
|
35
35
|
ecmaVersion: "latest",
|
|
36
36
|
ranges: true
|
|
37
37
|
});
|
|
38
|
-
} catch
|
|
38
|
+
} catch {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
let insertionPoint = 0;
|
|
@@ -316,7 +316,7 @@ const NuxtRootStubPlugin = createUnplugin((options) => {
|
|
|
316
316
|
};
|
|
317
317
|
});
|
|
318
318
|
|
|
319
|
-
const vitePluginBlocklist = ["vite-plugin-vue-inspector", "vite-plugin-vue-inspector:post", "vite-plugin-inspect"];
|
|
319
|
+
const vitePluginBlocklist = ["vite-plugin-vue-inspector", "vite-plugin-vue-inspector:post", "vite-plugin-inspect", "nuxt:type-check"];
|
|
320
320
|
const module = defineNuxtModule({
|
|
321
321
|
meta: {
|
|
322
322
|
name: "@nuxt/test-utils",
|
package/dist/playwright.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
export { expect } from '@playwright/test';
|
|
3
3
|
import { Response } from 'playwright-core';
|
|
4
|
-
import { T as TestOptions$1, b as TestHooks, G as GotoOptions } from './shared/test-utils.
|
|
4
|
+
import { T as TestOptions$1, b as TestHooks, G as GotoOptions } from './shared/test-utils.CyoO8zI7.mjs';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
6
|
import 'execa';
|
|
7
|
-
import 'nitropack';
|
|
8
7
|
|
|
9
8
|
type ConfigOptions = {
|
|
10
9
|
nuxt: Partial<TestOptions$1> | undefined;
|
package/dist/playwright.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
2
|
export { expect } from '@playwright/test';
|
|
3
3
|
import { Response } from 'playwright-core';
|
|
4
|
-
import { T as TestOptions$1, b as TestHooks, G as GotoOptions } from './shared/test-utils.
|
|
4
|
+
import { T as TestOptions$1, b as TestHooks, G as GotoOptions } from './shared/test-utils.CyoO8zI7.js';
|
|
5
5
|
import '@nuxt/schema';
|
|
6
6
|
import 'execa';
|
|
7
|
-
import 'nitropack';
|
|
8
7
|
|
|
9
8
|
type ConfigOptions = {
|
|
10
9
|
nuxt: Partial<TestOptions$1> | undefined;
|
package/dist/playwright.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { test as test$1 } from '@playwright/test';
|
|
2
2
|
export { expect } from '@playwright/test';
|
|
3
|
-
import { e as createTest, w as waitForHydration } from './shared/test-utils.
|
|
3
|
+
import { e as createTest, w as waitForHydration } from './shared/test-utils.BZS9cHDP.mjs';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'defu';
|
|
6
6
|
import 'ufo';
|
|
7
7
|
import 'consola';
|
|
8
8
|
import 'node:fs';
|
|
9
9
|
import '@nuxt/kit';
|
|
10
|
-
import { d as url } from './shared/test-utils.
|
|
10
|
+
import { d as url } from './shared/test-utils.BumFEtZ8.mjs';
|
|
11
11
|
import 'pathe';
|
|
12
12
|
import 'node:url';
|
|
13
13
|
import 'execa';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as useTestContext, d as url, c as createTestContext, s as setTestContext, b as stopServer, a as startServer } from './test-utils.
|
|
1
|
+
import { u as useTestContext, d as url, c as createTestContext, s as setTestContext, b as stopServer, a as startServer } from './test-utils.BumFEtZ8.mjs';
|
|
2
2
|
import { existsSync, promises } from 'node:fs';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
4
|
import { defu } from 'defu';
|
|
@@ -18,7 +18,10 @@ function createTestContext(options) {
|
|
|
18
18
|
logLevel: 1,
|
|
19
19
|
server: true,
|
|
20
20
|
build: options.browser !== false || options.server !== false,
|
|
21
|
-
nuxtConfig: {
|
|
21
|
+
nuxtConfig: {
|
|
22
|
+
// suppress compatibility date warning for runtime environment tests
|
|
23
|
+
compatibilityDate: "2024-04-03"
|
|
24
|
+
},
|
|
22
25
|
browserOptions: {
|
|
23
26
|
type: "chromium"
|
|
24
27
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Browser, BrowserContextOptions, Page, Response as Response$1, LaunchOptions } from 'playwright-core';
|
|
2
2
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
3
3
|
import { ExecaChildProcess } from 'execa';
|
|
4
|
-
import * as nitropack from 'nitropack';
|
|
5
4
|
|
|
6
5
|
declare function createBrowser(): Promise<void>;
|
|
7
6
|
declare function getBrowser(): Promise<Browser>;
|
|
@@ -21,30 +20,68 @@ interface StartServerOptions {
|
|
|
21
20
|
declare function startServer(options?: StartServerOptions): Promise<void>;
|
|
22
21
|
declare function stopServer(): Promise<void>;
|
|
23
22
|
declare function fetch(path: string, options?: RequestInit): Promise<Response>;
|
|
24
|
-
declare const $fetch:
|
|
23
|
+
declare const $fetch: (typeof globalThis)["$fetch"];
|
|
25
24
|
declare function url(path: string): string;
|
|
26
25
|
|
|
27
26
|
type TestRunner = 'vitest' | 'jest' | 'cucumber';
|
|
28
27
|
interface TestOptions {
|
|
29
28
|
testDir: string;
|
|
30
29
|
fixture: string;
|
|
30
|
+
/**
|
|
31
|
+
* Name of the configuration file.
|
|
32
|
+
* @default `'nuxt.config`
|
|
33
|
+
*/
|
|
31
34
|
configFile: string;
|
|
35
|
+
/**
|
|
36
|
+
* Path to a directory with a Nuxt app to be put under test.
|
|
37
|
+
* @default `'.'`
|
|
38
|
+
*/
|
|
32
39
|
rootDir: string;
|
|
33
40
|
buildDir: string;
|
|
34
41
|
nuxtConfig: NuxtConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to run a separate build step.
|
|
44
|
+
* @default `true` (`false` if `browser` or `server` is disabled, or if a `host` is provided)
|
|
45
|
+
*/
|
|
35
46
|
build: boolean;
|
|
36
47
|
dev: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The amount of time (in milliseconds) to allow for `setupTest` to complete its work (which could include building or generating files for a Nuxt application, depending on the options that are passed).
|
|
50
|
+
* @default `60000`
|
|
51
|
+
*/
|
|
37
52
|
setupTimeout: number;
|
|
38
53
|
waitFor: number;
|
|
54
|
+
/**
|
|
55
|
+
* Under the hood, Nuxt test utils uses [`playwright`](https://playwright.dev) to carry out browser testing. If this option is set, a browser will be launched and can be controlled in the subsequent test suite.
|
|
56
|
+
* @default `false`
|
|
57
|
+
*/
|
|
39
58
|
browser: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Specify the runner for the test suite. One of `'vitest' | 'jest' | 'cucumber'`.
|
|
61
|
+
* @default `vitest`
|
|
62
|
+
*/
|
|
40
63
|
runner: TestRunner;
|
|
41
64
|
logLevel: number;
|
|
42
65
|
browserOptions: {
|
|
66
|
+
/** The type of browser to launch - either `chromium`, `firefox` or `webkit` */
|
|
43
67
|
type: 'chromium' | 'firefox' | 'webkit';
|
|
68
|
+
/** `object` of options that will be passed to playwright when launching the browser. See [full API reference](https://playwright.dev/docs/api/class-browsertype#browser-type-launch). */
|
|
44
69
|
launch?: LaunchOptions;
|
|
45
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Whether to launch a server to respond to requests in the test suite.
|
|
73
|
+
* @default `true` (`false` if a `host` is provided)
|
|
74
|
+
*/
|
|
46
75
|
server: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* If provided, a URL to use as the test target instead of building and running a new server. Useful for running "real" end-to-end tests against a deployed version of your application, or against an already running local server.
|
|
78
|
+
* @default `undefined`
|
|
79
|
+
*/
|
|
47
80
|
host?: string;
|
|
81
|
+
/**
|
|
82
|
+
* If provided, set the launched test server port to the value.
|
|
83
|
+
* @default `undefined`
|
|
84
|
+
*/
|
|
48
85
|
port?: number;
|
|
49
86
|
env?: StartServerOptions['env'];
|
|
50
87
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Browser, BrowserContextOptions, Page, Response as Response$1, LaunchOptions } from 'playwright-core';
|
|
2
2
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
3
3
|
import { ExecaChildProcess } from 'execa';
|
|
4
|
-
import * as nitropack from 'nitropack';
|
|
5
4
|
|
|
6
5
|
declare function createBrowser(): Promise<void>;
|
|
7
6
|
declare function getBrowser(): Promise<Browser>;
|
|
@@ -21,30 +20,68 @@ interface StartServerOptions {
|
|
|
21
20
|
declare function startServer(options?: StartServerOptions): Promise<void>;
|
|
22
21
|
declare function stopServer(): Promise<void>;
|
|
23
22
|
declare function fetch(path: string, options?: RequestInit): Promise<Response>;
|
|
24
|
-
declare const $fetch:
|
|
23
|
+
declare const $fetch: (typeof globalThis)["$fetch"];
|
|
25
24
|
declare function url(path: string): string;
|
|
26
25
|
|
|
27
26
|
type TestRunner = 'vitest' | 'jest' | 'cucumber';
|
|
28
27
|
interface TestOptions {
|
|
29
28
|
testDir: string;
|
|
30
29
|
fixture: string;
|
|
30
|
+
/**
|
|
31
|
+
* Name of the configuration file.
|
|
32
|
+
* @default `'nuxt.config`
|
|
33
|
+
*/
|
|
31
34
|
configFile: string;
|
|
35
|
+
/**
|
|
36
|
+
* Path to a directory with a Nuxt app to be put under test.
|
|
37
|
+
* @default `'.'`
|
|
38
|
+
*/
|
|
32
39
|
rootDir: string;
|
|
33
40
|
buildDir: string;
|
|
34
41
|
nuxtConfig: NuxtConfig;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to run a separate build step.
|
|
44
|
+
* @default `true` (`false` if `browser` or `server` is disabled, or if a `host` is provided)
|
|
45
|
+
*/
|
|
35
46
|
build: boolean;
|
|
36
47
|
dev: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The amount of time (in milliseconds) to allow for `setupTest` to complete its work (which could include building or generating files for a Nuxt application, depending on the options that are passed).
|
|
50
|
+
* @default `60000`
|
|
51
|
+
*/
|
|
37
52
|
setupTimeout: number;
|
|
38
53
|
waitFor: number;
|
|
54
|
+
/**
|
|
55
|
+
* Under the hood, Nuxt test utils uses [`playwright`](https://playwright.dev) to carry out browser testing. If this option is set, a browser will be launched and can be controlled in the subsequent test suite.
|
|
56
|
+
* @default `false`
|
|
57
|
+
*/
|
|
39
58
|
browser: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Specify the runner for the test suite. One of `'vitest' | 'jest' | 'cucumber'`.
|
|
61
|
+
* @default `vitest`
|
|
62
|
+
*/
|
|
40
63
|
runner: TestRunner;
|
|
41
64
|
logLevel: number;
|
|
42
65
|
browserOptions: {
|
|
66
|
+
/** The type of browser to launch - either `chromium`, `firefox` or `webkit` */
|
|
43
67
|
type: 'chromium' | 'firefox' | 'webkit';
|
|
68
|
+
/** `object` of options that will be passed to playwright when launching the browser. See [full API reference](https://playwright.dev/docs/api/class-browsertype#browser-type-launch). */
|
|
44
69
|
launch?: LaunchOptions;
|
|
45
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Whether to launch a server to respond to requests in the test suite.
|
|
73
|
+
* @default `true` (`false` if a `host` is provided)
|
|
74
|
+
*/
|
|
46
75
|
server: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* If provided, a URL to use as the test target instead of building and running a new server. Useful for running "real" end-to-end tests against a deployed version of your application, or against an already running local server.
|
|
78
|
+
* @default `undefined`
|
|
79
|
+
*/
|
|
47
80
|
host?: string;
|
|
81
|
+
/**
|
|
82
|
+
* If provided, set the launched test server port to the value.
|
|
83
|
+
* @default `undefined`
|
|
84
|
+
*/
|
|
48
85
|
port?: number;
|
|
49
86
|
env?: StartServerOptions['env'];
|
|
50
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/test-utils",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/test-utils.git"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"fake-indexeddb": "^6.0.0",
|
|
52
52
|
"get-port-please": "^3.1.2",
|
|
53
53
|
"local-pkg": "^0.5.0",
|
|
54
|
-
"magic-string": "^0.30.
|
|
54
|
+
"magic-string": "^0.30.11",
|
|
55
55
|
"node-fetch-native": "^1.6.4",
|
|
56
56
|
"ofetch": "^1.3.4",
|
|
57
57
|
"pathe": "^1.1.2",
|
|
@@ -61,36 +61,38 @@
|
|
|
61
61
|
"std-env": "^3.7.0",
|
|
62
62
|
"ufo": "^1.5.4",
|
|
63
63
|
"unenv": "^1.10.0",
|
|
64
|
-
"unplugin": "^1.12.
|
|
64
|
+
"unplugin": "^1.12.1",
|
|
65
65
|
"vitest-environment-nuxt": "^1.0.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@cucumber/cucumber": "10.8.0",
|
|
69
69
|
"@jest/globals": "29.7.0",
|
|
70
70
|
"@nuxt/devtools": "1.0.8",
|
|
71
|
-
"@nuxt/eslint-config": "0.
|
|
72
|
-
"@nuxt/module-builder": "0.8.
|
|
73
|
-
"@playwright/test": "1.
|
|
71
|
+
"@nuxt/eslint-config": "0.5.0",
|
|
72
|
+
"@nuxt/module-builder": "0.8.2",
|
|
73
|
+
"@playwright/test": "1.46.0",
|
|
74
74
|
"@testing-library/vue": "8.1.0",
|
|
75
75
|
"@types/estree": "1.0.5",
|
|
76
76
|
"@types/jsdom": "21.1.7",
|
|
77
77
|
"@types/semver": "7.5.8",
|
|
78
|
-
"@vitest/ui": "2.0.
|
|
78
|
+
"@vitest/ui": "2.0.5",
|
|
79
79
|
"@vue/test-utils": "2.4.6",
|
|
80
80
|
"changelogen": "0.5.5",
|
|
81
|
-
"
|
|
81
|
+
"compatx": "0.1.8",
|
|
82
|
+
"eslint": "9.9.0",
|
|
82
83
|
"h3": "1.12.0",
|
|
83
84
|
"jiti": "1.21.6",
|
|
84
85
|
"nitropack": "2.9.7",
|
|
85
86
|
"nuxt": "3.12.4",
|
|
86
|
-
"playwright-core": "1.
|
|
87
|
-
"rollup": "4.
|
|
87
|
+
"playwright-core": "1.46.0",
|
|
88
|
+
"rollup": "4.20.0",
|
|
88
89
|
"semver": "7.6.3",
|
|
90
|
+
"typescript": "5.5.4",
|
|
89
91
|
"unbuild": "latest",
|
|
90
|
-
"unimport": "3.
|
|
91
|
-
"vite": "5.
|
|
92
|
-
"vitest": "2.0.
|
|
93
|
-
"vue-router": "4.4.
|
|
92
|
+
"unimport": "3.10.0",
|
|
93
|
+
"vite": "5.4.0",
|
|
94
|
+
"vitest": "2.0.5",
|
|
95
|
+
"vue-router": "4.4.3",
|
|
94
96
|
"vue-tsc": "2.0.29"
|
|
95
97
|
},
|
|
96
98
|
"peerDependencies": {
|
|
@@ -144,20 +146,18 @@
|
|
|
144
146
|
},
|
|
145
147
|
"resolutions": {
|
|
146
148
|
"@cucumber/cucumber": "10.8.0",
|
|
149
|
+
"@nuxt/devtools": "1.0.8",
|
|
147
150
|
"@nuxt/kit": "^3.12.4",
|
|
148
151
|
"@nuxt/schema": "^3.12.4",
|
|
149
152
|
"@nuxt/test-utils": "workspace:*",
|
|
150
|
-
"rollup": "4.
|
|
151
|
-
"vite": "5.
|
|
152
|
-
"
|
|
153
|
+
"rollup": "4.20.0",
|
|
154
|
+
"vite": "5.4.0",
|
|
155
|
+
"vite-node": "2.0.5",
|
|
156
|
+
"vitest": "2.0.5",
|
|
157
|
+
"vue": "^3.4.37"
|
|
153
158
|
},
|
|
154
159
|
"engines": {
|
|
155
160
|
"node": ">=18.20.4"
|
|
156
161
|
},
|
|
157
|
-
"packageManager": "pnpm@9.
|
|
158
|
-
"pnpm": {
|
|
159
|
-
"patchedDependencies": {
|
|
160
|
-
"nuxt@3.11.2": "patches/nuxt@3.11.2.patch"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
162
|
+
"packageManager": "pnpm@9.7.0"
|
|
163
163
|
}
|