@nuxt/test-utils 3.0.0-rc.11 → 3.0.0-rc.13
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/LICENSE +21 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +10 -4
- package/package.json +11 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 - Nuxt Project
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as playwright from 'playwright';
|
|
2
2
|
import { Browser, BrowserContextOptions, LaunchOptions } from 'playwright';
|
|
3
3
|
import { NuxtConfig, Nuxt } from '@nuxt/schema';
|
|
4
4
|
import { ExecaChildProcess } from 'execa';
|
|
@@ -6,7 +6,7 @@ import { FetchOptions } from 'ohmyfetch';
|
|
|
6
6
|
|
|
7
7
|
declare function createBrowser(): Promise<void>;
|
|
8
8
|
declare function getBrowser(): Promise<Browser>;
|
|
9
|
-
declare function createPage(path?: string, options?: BrowserContextOptions): Promise<
|
|
9
|
+
declare function createPage(path?: string, options?: BrowserContextOptions): Promise<playwright.Page>;
|
|
10
10
|
|
|
11
11
|
declare type TestRunner = 'vitest' | 'jest';
|
|
12
12
|
interface TestOptions {
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ function createTestContext(options) {
|
|
|
13
13
|
testDir: resolve(process.cwd(), "test"),
|
|
14
14
|
fixture: "fixture",
|
|
15
15
|
configFile: "nuxt.config",
|
|
16
|
-
setupTimeout:
|
|
16
|
+
setupTimeout: 120 * 1e3,
|
|
17
17
|
dev: !!JSON.parse(process.env.NUXT_TEST_DEV || "false"),
|
|
18
18
|
logLevel: 1,
|
|
19
19
|
server: true,
|
|
@@ -57,6 +57,7 @@ async function startServer() {
|
|
|
57
57
|
env: {
|
|
58
58
|
...process.env,
|
|
59
59
|
PORT: String(port),
|
|
60
|
+
NITRO_PORT: String(port),
|
|
60
61
|
NODE_ENV: "development"
|
|
61
62
|
}
|
|
62
63
|
});
|
|
@@ -80,6 +81,7 @@ async function startServer() {
|
|
|
80
81
|
env: {
|
|
81
82
|
...process.env,
|
|
82
83
|
PORT: String(port),
|
|
84
|
+
NITRO_PORT: String(port),
|
|
83
85
|
NODE_ENV: "test"
|
|
84
86
|
}
|
|
85
87
|
});
|
|
@@ -202,7 +204,7 @@ async function buildFixture() {
|
|
|
202
204
|
async function setupJest(hooks) {
|
|
203
205
|
const jest = await import('jest');
|
|
204
206
|
hooks.ctx.mockFn = jest.fn;
|
|
205
|
-
test("setup", hooks.setup,
|
|
207
|
+
test("setup", hooks.setup, hooks.ctx.options.setupTimeout);
|
|
206
208
|
beforeEach(hooks.beforeEach);
|
|
207
209
|
afterEach(hooks.afterEach);
|
|
208
210
|
afterAll(hooks.afterAll);
|
|
@@ -211,7 +213,7 @@ async function setupJest(hooks) {
|
|
|
211
213
|
async function setupVitest(hooks) {
|
|
212
214
|
const vitest = await import('vitest');
|
|
213
215
|
hooks.ctx.mockFn = vitest.vi.fn;
|
|
214
|
-
vitest.beforeAll(hooks.setup,
|
|
216
|
+
vitest.beforeAll(hooks.setup, hooks.ctx.options.setupTimeout);
|
|
215
217
|
vitest.beforeEach(hooks.beforeEach);
|
|
216
218
|
vitest.afterEach(hooks.afterEach);
|
|
217
219
|
vitest.afterAll(hooks.afterAll);
|
|
@@ -286,10 +288,14 @@ async function runTests(opts) {
|
|
|
286
288
|
}
|
|
287
289
|
const { startVitest } = await import('vitest/dist/node.mjs');
|
|
288
290
|
const succeeded = await startVitest(
|
|
291
|
+
"test",
|
|
289
292
|
[],
|
|
290
293
|
{
|
|
291
294
|
root: opts.rootDir,
|
|
292
|
-
run: !opts.watch
|
|
295
|
+
run: !opts.watch,
|
|
296
|
+
deps: {
|
|
297
|
+
inline: [/@nuxt\/test-utils/]
|
|
298
|
+
}
|
|
293
299
|
},
|
|
294
300
|
{
|
|
295
301
|
esbuild: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/test-utils",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.13",
|
|
4
4
|
"repository": "nuxt/framework",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -9,28 +9,26 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"prepack": "unbuild"
|
|
14
|
-
},
|
|
15
12
|
"dependencies": {
|
|
16
|
-
"@nuxt/kit": "3.0.0-rc.
|
|
17
|
-
"@nuxt/schema": "3.0.0-rc.
|
|
13
|
+
"@nuxt/kit": "3.0.0-rc.13",
|
|
14
|
+
"@nuxt/schema": "3.0.0-rc.13",
|
|
18
15
|
"consola": "^2.15.3",
|
|
19
16
|
"defu": "^6.1.0",
|
|
20
17
|
"execa": "^6.1.0",
|
|
21
18
|
"get-port-please": "^2.6.1",
|
|
22
19
|
"jiti": "^1.16.0",
|
|
23
|
-
"ohmyfetch": "^0.4.
|
|
20
|
+
"ohmyfetch": "^0.4.21"
|
|
24
21
|
},
|
|
25
22
|
"devDependencies": {
|
|
26
|
-
"playwright": "^1.
|
|
23
|
+
"playwright": "^1.27.1",
|
|
27
24
|
"unbuild": "latest",
|
|
28
|
-
"vitest": "
|
|
25
|
+
"vitest": "^0.24.5"
|
|
29
26
|
},
|
|
30
27
|
"peerDependencies": {
|
|
31
|
-
"vue": "^3.2.
|
|
28
|
+
"vue": "^3.2.41"
|
|
32
29
|
},
|
|
33
30
|
"engines": {
|
|
34
|
-
"node": "^14.16.0 || ^16.
|
|
35
|
-
}
|
|
36
|
-
}
|
|
31
|
+
"node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {}
|
|
34
|
+
}
|