Skip to content

Commit b4e637b

Browse files
committed
feat(config): support parallel test projects setup
1 parent 14fb254 commit b4e637b

20 files changed

+143
-32
lines changed
File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
describe('app', () => {
4+
it('useAppConfig', () => {
5+
expect(Object.keys(useAppConfig())).toEqual(['nuxt'])
6+
})
7+
})

examples/app-vitest-workspace/test/index.unit.spec.ts renamed to examples/app-vitest-workspace/app1/test/index.unit.spec.ts

File renamed without changes.

examples/app-vitest-workspace/test/registerEndpoint.nuxt.spec.ts renamed to examples/app-vitest-workspace/app1/test/registerEndpoint.nuxt.spec.ts

File renamed without changes.

examples/app-vitest-workspace/test/setup/setup-nuxt.ts renamed to examples/app-vitest-workspace/app1/test/setup/setup-nuxt.ts

File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"files": [],
3+
"references": [
4+
{
5+
"path": "./.nuxt/tsconfig.app.json"
6+
},
7+
{
8+
"path": "./.nuxt/tsconfig.server.json"
9+
},
10+
{
11+
"path": "./.nuxt/tsconfig.shared.json"
12+
},
13+
{
14+
"path": "./.nuxt/tsconfig.node.json"
15+
}
16+
]
17+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { fileURLToPath } from 'node:url'
2+
import { defineVitestProject } from '@nuxt/test-utils/config'
3+
4+
export default defineVitestProject({
5+
test: {
6+
name: 'nuxt-app1',
7+
include: ['**/*.nuxt.spec.ts'],
8+
setupFiles: ['test/setup/setup-nuxt.ts'],
9+
environmentOptions: {
10+
nuxt: {
11+
rootDir: fileURLToPath(new URL('.', import.meta.url)),
12+
},
13+
},
14+
},
15+
})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineProject } from 'vitest/config'
2+
3+
export default defineProject({
4+
test: {
5+
name: 'unit-app1',
6+
include: ['**/*.unit.spec.ts'],
7+
},
8+
})
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// https://nuxt.com/docs/api/configuration/nuxt-config
2+
export default defineNuxtConfig({
3+
modules: ['@nuxtjs/color-mode', '@nuxt/ui'],
4+
devtools: { enabled: true },
5+
compatibilityDate: '2024-04-03',
6+
})
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
describe('app', () => {
4+
it('useAppConfig', () => {
5+
expect(
6+
Object.keys(useAppConfig()).toSorted(),
7+
).toEqual(['nuxt', 'ui', 'icon'].toSorted())
8+
})
9+
10+
it('useRuntimeConfig', () => {
11+
expect(useRuntimeConfig().icon).toBeDefined()
12+
})
13+
})

0 commit comments

Comments
 (0)