@nuxt/test-utils 3.0.0 → 3.1.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- MIT License
1
+ The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 - Nuxt Project
3
+ Copyright (c) 2016-present - Nuxt Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,3 +1,128 @@
1
- # Nuxt Test Utils
2
1
 
3
- Test utilities for Nuxt.
2
+ [![Nuxt banner](./.github/assets/banner.png)](https://nuxt.com)
3
+
4
+ # 👋 Welcome to Nuxt
5
+
6
+
7
+ Nuxt's goal is to make web development intuitive and performant, with a great developer experience.<br>Learn more in the ['What is Nuxt?'](https://nuxt.com/docs/getting-started/introduction) section of our documentation.
8
+
9
+
10
+ <p>
11
+ <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a>
12
+ <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a>
13
+ <a href="./LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
14
+ <a href="https://volta.net/nuxt/nuxt?utm_source=nuxt_readme"><img src="https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg" alt="Volta board"></a>
15
+ </p>
16
+
17
+ <table>
18
+ <thead>
19
+ <tr>
20
+ <th width="2000" colspan="2">
21
+ </th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <tr>
26
+ <td width="80" align="center" valign="top">
27
+ <br>
28
+ <a href="https://nuxt.com/docs"><img src="./.github/assets/documentation.png"></a>
29
+ </td>
30
+ <td valign="top">
31
+ <h3>Documentation</h3>
32
+ <p>
33
+ We highly recommend you take a look at <a href="https://nuxt.com">the Nuxt documentation</a> to level up.
34
+ </p>
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <td width="80" align="center" valign="top">
39
+ <br>
40
+ <a href="https://nuxt.com/modules"><img src="./.github/assets/modules.png"></a>
41
+ </td>
42
+ <td valign="top">
43
+ <h3>Modules</h3>
44
+ <p>
45
+ Discover our <a href="https://nuxt.com/modules">list of modules</a> to supercharge your Nuxt project. Created by the Nuxt team and community.
46
+ </p>
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <td width="80" align="center" valign="top">
51
+ <br>
52
+ <a href="https://nuxt.com/docs/examples/hello-world"><img src="./.github/assets/examples.png"></a>
53
+ </td>
54
+ <td>
55
+ <h3>Examples</h3>
56
+ <p>
57
+ Explore different ways of using Nuxt features and get inspired with <a href="https://nuxt.com/docs/examples/essentials/hello-world">our list of examples</a>.
58
+ </p>
59
+ </td>
60
+ </tr>
61
+ </tbody>
62
+ </table>
63
+
64
+ <table>
65
+ <thead>
66
+ <tr>
67
+ <th width="2000" colspan="2">
68
+ </th>
69
+ </tr>
70
+ </thead>
71
+ <tbody>
72
+ <tr>
73
+ <td width="80" align="center" valign="top">
74
+ <br>
75
+ <a href="https://nuxt.com/docs/community/reporting-bugs"><img src="./.github/assets/reporting-bugs.png"></a>
76
+ </td>
77
+ <td valign="top">
78
+ <h3>Reporting bugs</h3>
79
+ <p>
80
+ Check out the <a href="https://nuxt.com/docs/community/reporting-bugs">Reporting Bugs</a> page.</p>
81
+ </p>
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <td width="80" align="center" valign="top">
86
+ <br>
87
+ <a href="https://nuxt.com/docs/community/contribution"><img src="./.github/assets/suggestions.png"></a>
88
+ </td>
89
+ <td valign="top">
90
+ <h3>Suggestions</h3>
91
+ <p>
92
+ Check out the <a href="https://nuxt.com/docs/community/contribution">Contribution</a> page.
93
+ </p>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <td width="80" align="center" valign="top">
98
+ <br>
99
+ <a href="https://nuxt.com/docs/community/getting-help"><img src="./.github/assets/questions.png"></a>
100
+ </td>
101
+ <td valign="top">
102
+ <h3>Questions</h3>
103
+ <p>
104
+ Check out the <a href="https://nuxt.com/docs/community/getting-help">Getting Help</a> page.
105
+ </p>
106
+ </td>
107
+ </tr>
108
+ </tbody>
109
+ </table>
110
+
111
+ ## Local Development
112
+
113
+ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#set-up-your-local-development-environment) to contribute to the framework and documentation.
114
+
115
+ ## Nuxt 2
116
+
117
+ You can find the code for Nuxt 2 on the [`2.x-dev` branch](https://github.com/nuxt/nuxt/tree/2.x-dev) and the documentation at [nuxtjs.org](https://nuxtjs.org).
118
+
119
+ ## Follow us
120
+
121
+ <p valign="center">
122
+ <a href="https://chat.nuxt.dev"><img width="20px" src="./.github/assets/discord.svg" alt="Discord"></a>&nbsp;&nbsp;<a href="https://twitter.nuxt.dev"><img width="20px" src="./.github/assets/twitter.svg" alt="Twitter"></a>&nbsp;&nbsp;<a href="https://github.nuxt.dev"><img width="20px" src="./.github/assets/github.svg" alt="GitHub"></a>
123
+ </p>
124
+
125
+ ## License
126
+
127
+ [MIT](./LICENSE)
128
+
package/dist/index.mjs CHANGED
@@ -21,6 +21,7 @@ function createTestContext(options) {
21
21
  server: true,
22
22
  build: options.browser !== false || options.server !== false,
23
23
  nuxtConfig: {},
24
+ // TODO: auto detect based on process.env
24
25
  runner: "vitest",
25
26
  browserOptions: {
26
27
  type: "chromium"
@@ -205,12 +206,14 @@ async function loadFixture() {
205
206
  overrides: ctx.options.nuxtConfig,
206
207
  configFile: ctx.options.configFile
207
208
  });
208
- kit.logger.level = ctx.options.logLevel;
209
209
  await promises.mkdir(ctx.nuxt.options.buildDir, { recursive: true });
210
210
  }
211
211
  async function buildFixture() {
212
212
  const ctx = useTestContext();
213
+ const prevLevel = kit.logger.level;
214
+ kit.logger.level = ctx.options.logLevel;
213
215
  await kit.buildNuxt(ctx.nuxt);
216
+ kit.logger.level = prevLevel;
214
217
  }
215
218
 
216
219
  async function setupJest(hooks) {
@@ -307,6 +310,7 @@ async function runTests(opts) {
307
310
  const succeeded = await startVitest(
308
311
  "test",
309
312
  [],
313
+ // Vitest options
310
314
  {
311
315
  root: opts.rootDir,
312
316
  run: !opts.watch,
@@ -314,6 +318,7 @@ async function runTests(opts) {
314
318
  inline: [/@nuxt\/test-utils/]
315
319
  }
316
320
  },
321
+ // Vite options
317
322
  {
318
323
  esbuild: {
319
324
  tsconfigRaw: "{}"
@@ -1,8 +1,13 @@
1
+ import * as _kit from "@nuxt/kit";
1
2
  import { createTest, exposeContextToEnv } from "@nuxt/test-utils";
2
- const hooks = createTest(JSON.parse(process.env.NUXT_TEST_OPTIONS || "{}"));
3
+ const kit = _kit.default || _kit;
4
+ const options = JSON.parse(process.env.NUXT_TEST_OPTIONS || "{}");
5
+ const hooks = createTest(options);
3
6
  export const setup = async () => {
7
+ kit.logger.info("Building Nuxt app...");
4
8
  await hooks.setup();
5
9
  exposeContextToEnv();
10
+ kit.logger.info("Running tests...");
6
11
  };
7
12
  export const teardown = async () => {
8
13
  await hooks.afterAll();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/test-utils",
3
- "version": "3.0.0",
4
- "repository": "nuxt/framework",
3
+ "version": "3.1.1",
4
+ "repository": "nuxt/nuxt",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": "./dist/index.mjs",
@@ -10,20 +10,20 @@
10
10
  "dist"
11
11
  ],
12
12
  "dependencies": {
13
- "@nuxt/kit": "3.0.0",
14
- "@nuxt/schema": "3.0.0",
13
+ "@nuxt/kit": "3.1.1",
14
+ "@nuxt/schema": "3.1.1",
15
15
  "consola": "^2.15.3",
16
- "defu": "^6.1.1",
16
+ "defu": "^6.1.2",
17
17
  "execa": "^6.1.0",
18
- "get-port-please": "^2.6.1",
19
- "jiti": "^1.16.0",
18
+ "get-port-please": "^3.0.1",
19
+ "jiti": "^1.16.2",
20
20
  "ofetch": "^1.0.0",
21
- "pathe": "^1.0.0"
21
+ "pathe": "^1.1.0"
22
22
  },
23
23
  "devDependencies": {
24
- "playwright": "^1.27.1",
24
+ "playwright": "^1.30.0",
25
25
  "unbuild": "latest",
26
- "vitest": "^0.25.2"
26
+ "vitest": "^0.28.2"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vue": "^3.2.45"