@nuxt/test-utils 3.7.1 → 3.7.2
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/README.md
CHANGED
|
@@ -26,7 +26,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
|
|
|
26
26
|
Use the following command to create a new starter project. This will create a starter project with all the necessary files and dependencies:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npx nuxi@latest
|
|
29
|
+
npx nuxi@latest init <my-project>
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Discover also [nuxt.new](https://nuxt.new): Open a Nuxt starter on CodeSandbox, StackBlitz or locally to get up and running in a few seconds.
|
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.8f432eb9.mjs';
|
|
4
4
|
import 'execa';
|
|
5
5
|
import 'get-port-please';
|
|
6
6
|
import 'ofetch';
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as useTestContext, a as url, c as createTestContext, s as setTestContext, b as stopServer, d as startServer } from './shared/test-utils.
|
|
2
|
-
export { $ as $fetch, e as exposeContextToEnv, f as fetch, i as isDev, r as recoverContextFromEnv } from './shared/test-utils.
|
|
1
|
+
import { u as useTestContext, a as url, c as createTestContext, s as setTestContext, b as stopServer, d as startServer } from './shared/test-utils.8f432eb9.mjs';
|
|
2
|
+
export { $ as $fetch, e as exposeContextToEnv, f as fetch, i as isDev, r as recoverContextFromEnv } from './shared/test-utils.8f432eb9.mjs';
|
|
3
3
|
import { consola } from 'consola';
|
|
4
4
|
import { promises, existsSync } from 'node:fs';
|
|
5
5
|
import { resolve } from 'node:path';
|
|
@@ -57,8 +57,9 @@ const kit = _kit.default || _kit;
|
|
|
57
57
|
async function startServer() {
|
|
58
58
|
const ctx = useTestContext();
|
|
59
59
|
await stopServer();
|
|
60
|
-
const
|
|
61
|
-
|
|
60
|
+
const host = "127.0.0.1";
|
|
61
|
+
const port = ctx.options.port || await getRandomPort(host);
|
|
62
|
+
ctx.url = `http://${host}:${port}`;
|
|
62
63
|
if (ctx.options.dev) {
|
|
63
64
|
const nuxiCLI = await kit.resolvePath("nuxi/cli");
|
|
64
65
|
ctx.serverProcess = execa(nuxiCLI, ["_dev"], {
|
|
@@ -67,12 +68,14 @@ async function startServer() {
|
|
|
67
68
|
env: {
|
|
68
69
|
...process.env,
|
|
69
70
|
_PORT: String(port),
|
|
71
|
+
// Used by internal _dev command
|
|
70
72
|
PORT: String(port),
|
|
71
|
-
|
|
73
|
+
HOST: host,
|
|
72
74
|
NODE_ENV: "development"
|
|
73
75
|
}
|
|
74
76
|
});
|
|
75
|
-
await waitForPort(port, { retries: 32 })
|
|
77
|
+
await waitForPort(port, { retries: 32, host }).catch(() => {
|
|
78
|
+
});
|
|
76
79
|
let lastError;
|
|
77
80
|
for (let i = 0; i < 150; i++) {
|
|
78
81
|
await new Promise((resolve2) => setTimeout(resolve2, 100));
|
|
@@ -95,11 +98,11 @@ async function startServer() {
|
|
|
95
98
|
env: {
|
|
96
99
|
...process.env,
|
|
97
100
|
PORT: String(port),
|
|
98
|
-
|
|
101
|
+
HOST: host,
|
|
99
102
|
NODE_ENV: "test"
|
|
100
103
|
}
|
|
101
104
|
});
|
|
102
|
-
await waitForPort(port, { retries:
|
|
105
|
+
await waitForPort(port, { retries: 20, host });
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
async function stopServer() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/test-utils",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"repository": "nuxt/nuxt",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"consola": "^3.2.3",
|
|
23
23
|
"defu": "^6.1.2",
|
|
24
24
|
"execa": "^7.2.0",
|
|
25
|
-
"get-port-please": "^3.
|
|
25
|
+
"get-port-please": "^3.1.1",
|
|
26
26
|
"ofetch": "^1.3.3",
|
|
27
27
|
"pathe": "^1.1.1",
|
|
28
28
|
"ufo": "^1.3.0",
|
|
29
|
-
"@nuxt/kit": "3.7.
|
|
30
|
-
"@nuxt/schema": "3.7.
|
|
29
|
+
"@nuxt/kit": "3.7.2",
|
|
30
|
+
"@nuxt/schema": "3.7.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@jest/globals": "29.
|
|
33
|
+
"@jest/globals": "29.7.0",
|
|
34
34
|
"playwright-core": "1.37.1",
|
|
35
35
|
"unbuild": "latest",
|
|
36
36
|
"vitest": "0.33.0"
|