@nuxt/test-utils 3.0.0-rc.10 → 3.0.0-rc.12
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 +13 -6
- 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,
|
|
@@ -202,7 +202,7 @@ async function buildFixture() {
|
|
|
202
202
|
async function setupJest(hooks) {
|
|
203
203
|
const jest = await import('jest');
|
|
204
204
|
hooks.ctx.mockFn = jest.fn;
|
|
205
|
-
test("setup", hooks.setup,
|
|
205
|
+
test("setup", hooks.setup, hooks.ctx.options.setupTimeout);
|
|
206
206
|
beforeEach(hooks.beforeEach);
|
|
207
207
|
afterEach(hooks.afterEach);
|
|
208
208
|
afterAll(hooks.afterAll);
|
|
@@ -211,7 +211,7 @@ async function setupJest(hooks) {
|
|
|
211
211
|
async function setupVitest(hooks) {
|
|
212
212
|
const vitest = await import('vitest');
|
|
213
213
|
hooks.ctx.mockFn = vitest.vi.fn;
|
|
214
|
-
vitest.beforeAll(hooks.setup,
|
|
214
|
+
vitest.beforeAll(hooks.setup, hooks.ctx.options.setupTimeout);
|
|
215
215
|
vitest.beforeEach(hooks.beforeEach);
|
|
216
216
|
vitest.afterEach(hooks.afterEach);
|
|
217
217
|
vitest.afterAll(hooks.afterAll);
|
|
@@ -285,18 +285,25 @@ async function runTests(opts) {
|
|
|
285
285
|
process.env.NUXT_TEST_DEV = "true";
|
|
286
286
|
}
|
|
287
287
|
const { startVitest } = await import('vitest/dist/node.mjs');
|
|
288
|
-
const
|
|
288
|
+
const args = [
|
|
289
289
|
[],
|
|
290
290
|
{
|
|
291
291
|
root: opts.rootDir,
|
|
292
|
-
run: !opts.watch
|
|
292
|
+
run: !opts.watch,
|
|
293
|
+
deps: {
|
|
294
|
+
inline: [/@nuxt\/test-utils/]
|
|
295
|
+
}
|
|
293
296
|
},
|
|
294
297
|
{
|
|
295
298
|
esbuild: {
|
|
296
299
|
tsconfigRaw: "{}"
|
|
297
300
|
}
|
|
298
301
|
}
|
|
299
|
-
|
|
302
|
+
];
|
|
303
|
+
if (startVitest.length >= 4) {
|
|
304
|
+
args.unshift("test");
|
|
305
|
+
}
|
|
306
|
+
const succeeded = await startVitest(...args);
|
|
300
307
|
if (!succeeded) {
|
|
301
308
|
process.exit(1);
|
|
302
309
|
}
|
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.12",
|
|
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.12",
|
|
14
|
+
"@nuxt/schema": "3.0.0-rc.12",
|
|
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
|
-
"jiti": "^1.
|
|
23
|
-
"ohmyfetch": "^0.4.
|
|
19
|
+
"jiti": "^1.16.0",
|
|
20
|
+
"ohmyfetch": "^0.4.20"
|
|
24
21
|
},
|
|
25
22
|
"devDependencies": {
|
|
26
|
-
"playwright": "^1.
|
|
23
|
+
"playwright": "^1.27.1",
|
|
27
24
|
"unbuild": "latest",
|
|
28
25
|
"vitest": "~0.19.1"
|
|
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"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {}
|
|
34
|
+
}
|