nuxt-spec 0.2.0-alpha.7 → 0.2.0-alpha.9

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
@@ -37,7 +37,7 @@ If you don't want to use the CLI tool, or you want to understand its flow better
37
37
  1) Add following dependency into your `package.json`:
38
38
 
39
39
  ```
40
- "nuxt-spec": "0.2.0-alpha.7"
40
+ "nuxt-spec": "0.2.0-alpha.9"
41
41
  ```
42
42
 
43
43
  2) Add following section into your `nuxt.config.ts`:
@@ -48,10 +48,10 @@ extends: [
48
48
  ]
49
49
  ```
50
50
 
51
- 3) Add `.npmrc` file with following content (if you don't have it yet):
51
+ 3) Add `pnpm-workspace.yaml` file with following content (if you don't have it yet):
52
52
 
53
53
  ```
54
- shamefully-hoist=true
54
+ shamefullyHoist: true
55
55
  ```
56
56
 
57
57
  4) Add `vitest.config.ts` file with following content (if you don't have it yet):
@@ -89,7 +89,7 @@ test/
89
89
  └── vitest-unit.test.ts
90
90
  ```
91
91
 
92
- You can use sample files from the [project repository](https://github.com/AloisSeckar/nuxt-spec/tree/v0.2.0-alpha.7/test).
92
+ You can use sample files from the [project repository](https://github.com/AloisSeckar/nuxt-spec/tree/v0.2.0-alpha.9/test).
93
93
 
94
94
  ### Install and execute
95
95
 
@@ -249,11 +249,11 @@ Planned future development:
249
249
  - reason about (not) using Vitest browser mode (or make it optional)
250
250
  - solution for visual regression testing - (currently there is experimental custom solution)
251
251
 
252
- See [CHANGELOG.md](https://github.com/AloisSeckar/nuxt-spec/blob/v0.2.0-alpha.7/CHANGELOG.md) for the latest updates and features.
252
+ See [CHANGELOG.md](https://github.com/AloisSeckar/nuxt-spec/blob/v0.2.0-alpha.9/CHANGELOG.md) for the latest updates and features.
253
253
 
254
254
  ## Configuration
255
255
 
256
- By default, `nuxt-spec` uses Vitest configuration defined in [`/config/index.mjs`](https://github.com/AloisSeckar/nuxt-spec/blob/v0.2.0-alpha.7/config/index.mjs). The configuration is based on [Nuxt team recommendations](https://nuxt.com/docs/4.x/getting-started/testing) and our best judgement.
256
+ By default, `nuxt-spec` uses Vitest configuration defined in [`/config/index.mjs`](https://github.com/AloisSeckar/nuxt-spec/blob/v0.2.0-alpha.9/config/index.mjs). The configuration is based on [Nuxt team recommendations](https://nuxt.com/docs/4.x/getting-started/testing) and our best judgement.
257
257
 
258
258
  To add/override your custom config, you can create (or scaffold via CLI tool) a file named `vitest.config.ts` in the root of your project with the following content:
259
259
 
@@ -357,7 +357,7 @@ const html: string = await getAPIResultHtml('/', '#api-fetch', '/your-api', '#ap
357
357
  const html: string = await getAPIResultHtml(page, '#api-fetch', '/your-api', '#api-result')
358
358
  ```
359
359
 
360
- For detailed description, see [utils.d.ts](https://github.com/AloisSeckar/nuxt-spec/blob/v0.2.0-alpha.7/utils/index.d.ts).
360
+ For detailed description, see [utils.d.ts](https://github.com/AloisSeckar/nuxt-spec/blob/v0.2.0-alpha.9/utils/index.d.ts).
361
361
 
362
362
  ## Contact
363
363
 
package/app/app.vue CHANGED
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <h1>Nuxt Spec</h1>
3
+ <NuxtWelcome />
4
4
  <div>
5
5
  Test-pack layer for <a href="https://nuxt.com/">Nuxt</a> applications
6
6
  </div>
@@ -0,0 +1,2 @@
1
+ export { default as NuxtSpecTestComponent } from './NuxtSpecTestComponent.vue'
2
+ export { default as NuxtSpecApiTestComponent } from './NuxtSpecApiTestComponent.vue'
package/bin/setup.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  * Then it:
15
15
  * 1) adds `nuxt-spec` into `package.json` dependencies and removes `nuxt`, `vue` and `vue-router` if present
16
16
  * 2) adds `extends: ['nuxt-spec']` to `nuxt.config.ts`
17
- * 3) creates/updates `.npmrc` file (only if pnpm is used)
17
+ * 3) creates/updates `pnpm-workspace.yaml` file (only if pnpm is used)
18
18
  * 4) creates default `vitest.config.ts` file
19
19
  * 5) adds test-related scripts and pnpm approved build scripts (if using pnpm) in `package.json`
20
20
  * 6) creates sample test files
@@ -37,7 +37,7 @@ export async function specSetup(autoRun = false) {
37
37
  // add nuxt-spec
38
38
  try {
39
39
  await updateJsonFile('package.json', 'dependencies', {
40
- 'nuxt-spec': '0.2.0-alpha.7',
40
+ 'nuxt-spec': '0.2.0-alpha.9',
41
41
  }, isAutoRun, 'This will add \'nuxt-spec\' dependency to your \'package.json\'. Continue?')
42
42
  } catch (error) {
43
43
  console.error('Error adding \'nuxt-spec\' dependency:\n', error.message)
@@ -101,23 +101,23 @@ export async function specSetup(autoRun = false) {
101
101
  console.error('Error updating \'nuxt.config.ts\':\n', error.message)
102
102
  }
103
103
 
104
- // 3) .npmrc file (only if pnpm is used)
104
+ // 3) `pnpm-workspace.yaml` file (only if pnpm is used)
105
105
  if (packageManager === 'pnpm') {
106
106
  try {
107
- if (pathExists('.npmrc')) {
108
- await updateTextFile('.npmrc', ['shamefully-hoist=true'], isAutoRun, 'This will adjust \'.npmrc\' file in your project. Continue?')
107
+ if (pathExists('pnpm-workspace.yaml')) {
108
+ await updateTextFile('pnpm-workspace.yaml', ['shamefully-hoist=true'], isAutoRun, 'This will adjust \'pnpm-workspace.yaml\' file in your project. Continue?')
109
109
  } else {
110
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.7/.npmrc',
111
- '.npmrc', isAutoRun, 'This will add \'.npmrc\' file for your project. Continue?')
110
+ await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.9/config/templates/pnpm-workspace.yaml.template',
111
+ 'pnpm-workspace.yaml', isAutoRun, 'This will add \'pnpm-workspace.yaml\' file for your project. Continue?')
112
112
  }
113
113
  } catch (error) {
114
- console.error('Error setting up \'.npmrc\':\n', error.message)
114
+ console.error('Error setting up \'pnpm-workspace.yaml\':\n', error.message)
115
115
  }
116
116
  }
117
117
 
118
118
  // 4) create vitest.config.ts
119
119
  try {
120
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.7/config/vitest.config.ts.template',
120
+ await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.9/config/templates/vitest.config.ts.template',
121
121
  'vitest.config.ts', isAutoRun, 'This will create a new \'vitest.config.ts\' file for your project. Continue?')
122
122
  } catch (error) {
123
123
  console.error('Error setting up \'vitest.config.ts\':\n', error.message)
@@ -155,31 +155,31 @@ export async function specSetup(autoRun = false) {
155
155
  const createSampleTests = isAutoRun || await promptUser('Do you want to create sample tests in \'/test\' folder?')
156
156
  if (createSampleTests) {
157
157
  try {
158
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.7/test/browser/vitest-browser.test.ts',
158
+ await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.9/test/browser/vitest-browser.test.ts',
159
159
  'test/browser/vitest-browser.test.ts', true)
160
160
  } catch (error) {
161
161
  console.error('Error setting up \'vitest-browser.test.ts\':\n', error.message)
162
162
  }
163
163
  try {
164
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.7/test/e2e/nuxt-e2e.test.ts',
164
+ await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.9/test/e2e/nuxt-e2e.test.ts',
165
165
  'test/e2e/nuxt-e2e.test.ts', true)
166
166
  } catch (error) {
167
167
  console.error('Error setting up \'nuxt-e2e.test.ts\':\n', error.message)
168
168
  }
169
169
  try {
170
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.7/test/e2e/nuxt-visual.test.ts',
170
+ await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.9/test/e2e/nuxt-visual.test.ts',
171
171
  'test/e2e/nuxt-visual.test.ts', true)
172
172
  } catch (error) {
173
173
  console.error('Error setting up \'nuxt-visual.test.ts\':\n', error.message)
174
174
  }
175
175
  try {
176
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.7/test/nuxt/nuxt-unit.test.ts',
176
+ await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.9/test/nuxt/nuxt-unit.test.ts',
177
177
  'test/nuxt/nuxt-unit.test.ts', true)
178
178
  } catch (error) {
179
179
  console.error('Error setting up \'nuxt-unit.test.ts\':\n', error.message)
180
180
  }
181
181
  try {
182
- await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.7/test/unit/vitest-unit.test.ts',
182
+ await createFileFromWebTemplate('https://raw.githubusercontent.com/AloisSeckar/nuxt-spec/refs/tags/v0.2.0-alpha.9/test/unit/vitest-unit.test.ts',
183
183
  'test/unit/vitest-unit.test.ts', true)
184
184
  } catch (error) {
185
185
  console.error('Error setting up \'vitest-unit.test.ts\':\n', error.message)
package/config/index.mjs CHANGED
@@ -2,7 +2,8 @@
2
2
  // based on https://nuxt.com/docs/4.x/getting-started/testing#setup
3
3
  // `projects=false` can be used to suspend the default usage of "projects" in Vitest config
4
4
 
5
- import { mergeConfig } from './merge.js' // defu-based merge function
5
+ import { onConsoleLog } from './utils/warnings.mjs' // filter out unnecessary logs
6
+ import { mergeConfig } from './utils/merge.mjs' // defu-based merge function
6
7
  import { defineConfig } from 'vitest/config'
7
8
  import { defineVitestProject } from '@nuxt/test-utils/config'
8
9
  import { playwright } from '@vitest/browser-playwright'
@@ -10,7 +11,12 @@ import vue from '@vitejs/plugin-vue'
10
11
 
11
12
  export async function loadVitestConfig(userVitestConfig, projects = true) {
12
13
  const baseConfig = {
13
- test: {},
14
+ test: {
15
+ // filter-out unnecessary console logs coming from Vitest
16
+ // when the import is resolved, unnecessary stderr logs are also filtered-out
17
+ // as a side-effect
18
+ onConsoleLog,
19
+ },
14
20
  }
15
21
 
16
22
  if (projects === true) {
@@ -0,0 +1,4 @@
1
+ # settings for Nuxt & pnpm
2
+
3
+ # https://pnpm.io/settings#shamefullyhoist
4
+ shamefullyHoist: true
@@ -8,7 +8,7 @@
8
8
  import { createDefu } from 'defu'
9
9
 
10
10
  // in real Vitest config, "name" is nested inside another "test" object
11
- const getProjectName = (project) => project?.name ?? project?.test?.name
11
+ const getProjectName = project => project?.name ?? project?.test?.name
12
12
 
13
13
  export const mergeConfig = createDefu((obj, key, value) => {
14
14
  if (key === 'projects' && Array.isArray(obj[key]) && Array.isArray(value)) {
@@ -0,0 +1,26 @@
1
+ const messageFilters = [
2
+ // remove once @nuxt/test-utils starts depending on Vitest 4.1
3
+ // https://github.com/nuxt/test-utils/pull/1620
4
+ 'Importing from "vitest/environments" is deprecated',
5
+ // Node+Windows false positive
6
+ // https://github.com/nuxt/icon/issues/140
7
+ 'Use of deprecated trailing slash pattern mapping',
8
+ // remove once Vue stops considering <Suspense> experimental
9
+ '<Suspense> is an experimental feature',
10
+ ]
11
+
12
+ // 1) filter-out unnecessary stderr logs coming from Vitest
13
+ // (applied as side-effect on import)
14
+
15
+ const _stderrWrite = process.stderr.write.bind(process.stderr)
16
+ process.stderr.write = (chunk, ...args) => {
17
+ if (typeof chunk === 'string' && messageFilters.some(f => chunk.includes(f))) return true
18
+ return _stderrWrite(chunk, ...args)
19
+ }
20
+
21
+ // 2) filter-out unnecessary console logs coming from Vitest
22
+ // (used as Vitest onConsoleLog hook)
23
+
24
+ export function onConsoleLog(log) {
25
+ if (messageFilters.some(f => log.includes(f))) return false
26
+ }
package/package.json CHANGED
@@ -1,13 +1,29 @@
1
1
  {
2
2
  "name": "nuxt-spec",
3
- "version": "0.2.0-alpha.7",
3
+ "version": "0.2.0-alpha.9",
4
4
  "description": "Test-pack layer for Nuxt Applications",
5
- "repository": "github:AloisSeckar/nuxt-spec",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/AloisSeckar/nuxt-spec.git"
8
+ },
6
9
  "license": "MIT",
7
10
  "type": "module",
8
11
  "main": "./nuxt.config.ts",
12
+ "scripts": {
13
+ "analyze": "nuxt analyze",
14
+ "eslint": "eslint .",
15
+ "build": "pnpm test && nuxt build",
16
+ "dev": "nuxt dev",
17
+ "generate": "nuxt generate",
18
+ "prepublishOnly": "pnpm build",
19
+ "preview": "nuxt preview",
20
+ "start": "nuxt start",
21
+ "test": "vitest run",
22
+ "test-u": "vitest run -u",
23
+ "test-i": "vitest"
24
+ },
9
25
  "bin": {
10
- "nuxt-spec": "./bin/cli.js"
26
+ "nuxt-spec": "bin/cli.js"
11
27
  },
12
28
  "exports": {
13
29
  ".": "./nuxt.config.ts",
@@ -20,6 +36,10 @@
20
36
  "types": "./utils/index.d.ts",
21
37
  "import": "./utils/index.ts",
22
38
  "default": "./utils/index.ts"
39
+ },
40
+ "./components": {
41
+ "import": "./app/components/index.ts",
42
+ "default": "./app/components/index.ts"
23
43
  }
24
44
  },
25
45
  "files": [
@@ -38,27 +58,27 @@
38
58
  "@vitest/ui": "4.1.0",
39
59
  "@vue/test-utils": "2.4.6",
40
60
  "elrh-cosca": "0.3.5",
61
+ "fast-png": "8.0.0",
41
62
  "happy-dom": "20.8.4",
42
63
  "nuxt": "4.4.2",
43
64
  "pixelmatch": "7.1.0",
44
65
  "playwright-core": "1.58.2",
45
- "fast-png": "8.0.0",
46
66
  "typescript": "5.9.3",
47
67
  "vitest": "4.1.0",
48
68
  "vitest-browser-vue": "2.1.0",
49
69
  "vue": "3.5.30",
50
70
  "vue-router": "5.0.3"
51
71
  },
52
- "scripts": {
53
- "analyze": "nuxt analyze",
54
- "eslint": "eslint .",
55
- "build": "pnpm test && nuxt build",
56
- "dev": "nuxt dev",
57
- "generate": "nuxt generate",
58
- "preview": "nuxt preview",
59
- "start": "nuxt start",
60
- "test": "vitest run",
61
- "test-u": "vitest run -u",
62
- "test-i": "vitest"
63
- }
64
- }
72
+ "pnpm": {
73
+ "overrides": {
74
+ "vite": "npm:vite@8.0.1",
75
+ "minimatch": "^9.0.9",
76
+ "tar": "^7.5.10",
77
+ "h3@^1.0.0": "^1.15.8",
78
+ "h3-next": "npm:h3@^2.0.1-rc.15",
79
+ "serialize-javascript": "^7.0.3",
80
+ "devalue": "^5.6.4"
81
+ }
82
+ },
83
+ "packageManager": "pnpm@10.32.1"
84
+ }
@@ -86,4 +86,4 @@ function toRGBA(img: DecodedPng): Uint8Array {
86
86
  rgba[i * 4 + 3] = 255
87
87
  }
88
88
  return rgba
89
- }
89
+ }
@@ -1,3 +0,0 @@
1
- # settings for Nuxt & pnpm
2
- # https://cuyl.github.io/pnpm.github.io/npmrc/
3
- shamefully-hoist=true
package/nuxt.config.ts DELETED
@@ -1,14 +0,0 @@
1
- export default defineNuxtConfig({
2
- modules: [
3
- '@nuxt/eslint',
4
- '@nuxt/test-utils/module',
5
- ],
6
-
7
- compatibilityDate: '2026-03-15',
8
-
9
- eslint: {
10
- config: {
11
- stylistic: true,
12
- },
13
- },
14
- })