@nuxt/test-utils 3.15.2 → 3.15.4

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/dirs.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { dirname, resolve } from 'node:path'
1
2
  import { fileURLToPath } from 'node:url'
2
3
 
3
- export const distDir = fileURLToPath(new URL('./dist', import.meta.url))
4
+ export const distDir = resolve(dirname(fileURLToPath(import.meta.url)), 'dist')
package/dist/e2e.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { b as buildFixture, c as createBrowser, a as createPage, d as createTest, g as getBrowser, l as loadFixture, e as setup, s as setupMaps, w as waitForHydration } from './shared/test-utils.DeQRWngN.mjs';
2
- import { u as useTestContext } from './shared/test-utils.JktOT-Lz.mjs';
3
- 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.JktOT-Lz.mjs';
1
+ export { b as buildFixture, c as createBrowser, a as createPage, d as createTest, g as getBrowser, l as loadFixture, e as setup, s as setupMaps, w as waitForHydration } from './shared/test-utils.Cd3KiBTs.mjs';
2
+ import { u as useTestContext } from './shared/test-utils.DwnN34tK.mjs';
3
+ 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.DwnN34tK.mjs';
4
4
  import { consola } from 'consola';
5
5
  import { resolve } from 'pathe';
6
6
  import { distDir } from '#dirs';
@@ -12,6 +12,7 @@ import 'tinyexec';
12
12
  import 'get-port-please';
13
13
  import 'ofetch';
14
14
  import 'ufo';
15
+ import 'std-env';
15
16
 
16
17
  function mockFn() {
17
18
  const ctx = useTestContext();
@@ -1,12 +1,12 @@
1
1
  import { resolve } from 'pathe';
2
2
  import { stringifyQuery } from 'ufo';
3
- import { $ as $fetch, u as useTestContext } from './shared/test-utils.JktOT-Lz.mjs';
3
+ import { $ as $fetch, u as useTestContext } from './shared/test-utils.DwnN34tK.mjs';
4
4
  import 'tinyexec';
5
5
  import 'get-port-please';
6
6
  import 'ofetch';
7
- import '@nuxt/kit';
8
7
  import 'node:path';
9
8
  import 'defu';
9
+ import 'std-env';
10
10
 
11
11
  function $fetchComponent(filepath, props) {
12
12
  return $fetch(componentTestUrl(filepath, props));
@@ -1,13 +1,14 @@
1
1
  import defu from 'defu';
2
2
  import { test as test$1 } from '@playwright/test';
3
3
  export { expect } from '@playwright/test';
4
- import { d as createTest, w as waitForHydration } from './shared/test-utils.DeQRWngN.mjs';
4
+ import { d as createTest, w as waitForHydration } from './shared/test-utils.Cd3KiBTs.mjs';
5
5
  import 'node:path';
6
6
  import 'ufo';
7
+ import 'std-env';
7
8
  import 'consola';
8
9
  import 'node:fs';
9
10
  import '@nuxt/kit';
10
- import { d as url } from './shared/test-utils.JktOT-Lz.mjs';
11
+ import { d as url } from './shared/test-utils.DwnN34tK.mjs';
11
12
  import 'pathe';
12
13
  import '#dirs';
13
14
  import 'tinyexec';
@@ -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.JktOT-Lz.mjs';
1
+ import { u as useTestContext, d as url, c as createTestContext, s as setTestContext, b as stopServer, a as startServer } from './test-utils.DwnN34tK.mjs';
2
2
  import { existsSync, promises } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
4
  import { defu } from 'defu';
@@ -1,11 +1,11 @@
1
- import { exec } from 'tinyexec';
1
+ import { x } from 'tinyexec';
2
2
  import { getRandomPort, waitForPort } from 'get-port-please';
3
3
  import { fetch as fetch$1, $fetch as $fetch$1 } from 'ofetch';
4
- import * as _kit from '@nuxt/kit';
5
4
  import { resolve as resolve$1 } from 'pathe';
6
5
  import { withTrailingSlash, joinURL } from 'ufo';
7
6
  import { resolve } from 'node:path';
8
7
  import { defu } from 'defu';
8
+ import { isWindows } from 'std-env';
9
9
 
10
10
  let currentContext;
11
11
  function createTestContext(options) {
@@ -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: 120 * 1e3,
16
+ setupTimeout: isWindows ? 24e4 : 12e4,
17
17
  dev: !!JSON.parse(process.env.NUXT_TEST_DEV || "false"),
18
18
  logLevel: 1,
19
19
  server: true,
@@ -69,7 +69,6 @@ function exposeContextToEnv() {
69
69
  process.env.NUXT_TEST_CONTEXT = JSON.stringify({ options, browser, url });
70
70
  }
71
71
 
72
- const kit = _kit.default || _kit;
73
72
  async function startServer(options = {}) {
74
73
  const ctx = useTestContext();
75
74
  await stopServer();
@@ -77,8 +76,8 @@ async function startServer(options = {}) {
77
76
  const port = ctx.options.port || await getRandomPort(host);
78
77
  ctx.url = `http://${host}:${port}/`;
79
78
  if (ctx.options.dev) {
80
- const nuxiCLI = await kit.resolvePath("nuxi/cli");
81
- ctx.serverProcess = exec(nuxiCLI, ["_dev"], {
79
+ ctx.serverProcess = x("nuxi", ["_dev"], {
80
+ throwOnError: true,
82
81
  nodeOptions: {
83
82
  cwd: ctx.nuxt.options.rootDir,
84
83
  stdio: "inherit",
@@ -114,10 +113,11 @@ async function startServer(options = {}) {
114
113
  throw lastError || new Error("Timeout waiting for dev server!");
115
114
  } else {
116
115
  const outputDir = ctx.nuxt ? ctx.nuxt.options.nitro.output.dir : ctx.options.nuxtConfig.nitro.output.dir;
117
- ctx.serverProcess = exec(
116
+ ctx.serverProcess = x(
118
117
  "node",
119
118
  [resolve$1(outputDir, "server/index.mjs")],
120
119
  {
120
+ throwOnError: true,
121
121
  nodeOptions: {
122
122
  stdio: "inherit",
123
123
  env: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/test-utils",
3
- "version": "3.15.2",
3
+ "version": "3.15.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/test-utils.git"