Skip to content

Commit 652d857

Browse files
committed
test: fix workspace test
1 parent d17dbc5 commit 652d857

File tree

2 files changed

+8
-51
lines changed

2 files changed

+8
-51
lines changed

docs/.vitepress/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export default ({ mode }: { mode: string }) => {
7070
customIcon: {
7171
'CLI': 'vscode-icons:file-type-shell',
7272
'vitest.shims': 'vscode-icons:file-type-vitest',
73-
'vitest.workspace': 'vscode-icons:file-type-vitest',
7473
'vitest.config': 'vscode-icons:file-type-vitest',
7574
'.spec.ts': 'vscode-icons:file-type-testts',
7675
'.test.ts': 'vscode-icons:file-type-testts',

test/watch/test/config-watching.test.ts

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,14 @@ import { runInlineTests } from '../../test-utils'
33

44
const ts = String.raw
55

6-
test('reruns tests when configs change', async () => {
7-
const { fs, vitest } = await runInlineTests({
8-
'vitest.workspace.ts': [
9-
'./project-1',
10-
'./project-2',
11-
],
12-
'vitest.config.ts': {},
13-
'project-1/vitest.config.ts': {},
14-
'project-1/basic.test.ts': ts`
15-
import { test } from 'vitest'
16-
test('basic test 1', () => {})
17-
`,
18-
'project-2/vitest.config.ts': {},
19-
'project-2/basic.test.ts': ts`
20-
import { test } from 'vitest'
21-
test('basic test 2', () => {})
22-
`,
23-
}, { watch: true })
24-
25-
await vitest.waitForStdout('Waiting for file changes')
26-
vitest.resetOutput()
27-
28-
// editing the project config should trigger a restart
29-
fs.editFile('./project-1/vitest.config.ts', c => `\n${c}`)
30-
31-
await vitest.waitForStdout('Restarting due to config changes...')
32-
await vitest.waitForStdout('Waiting for file changes')
33-
vitest.resetOutput()
34-
35-
// editing the root config should trigger a restart
36-
fs.editFile('./vitest.config.ts', c => `\n${c}`)
37-
38-
await vitest.waitForStdout('Restarting due to config changes...')
39-
await vitest.waitForStdout('Waiting for file changes')
40-
vitest.resetOutput()
41-
42-
// editing the workspace config should trigger a restart
43-
fs.editFile('./vitest.workspace.ts', c => `\n${c}`)
44-
45-
await vitest.waitForStdout('Restarting due to config changes...')
46-
await vitest.waitForStdout('Waiting for file changes')
47-
})
48-
496
test('rerun stops the previous browser server and restarts multiple times without port mismatch', async () => {
507
const { fs, vitest } = await runInlineTests({
51-
'vitest.workspace.ts': [
52-
'./project-1',
53-
],
54-
'vitest.config.ts': {},
55-
'project-1/vitest.config.ts': {
8+
'vitest.config.js': {
9+
test: {
10+
projects: ['./project-1'],
11+
},
12+
},
13+
'project-1/vitest.config.js': {
5614
test: {
5715
browser: {
5816
enabled: true,
@@ -72,7 +30,7 @@ test('rerun stops the previous browser server and restarts multiple times withou
7230
vitest.resetOutput()
7331

7432
// editing the project config the first time restarts the browser server
75-
fs.editFile('./project-1/vitest.config.ts', c => `\n${c}`)
33+
fs.editFile('./project-1/vitest.config.js', c => `\n${c}`)
7634

7735
await vitest.waitForStdout('Restarting due to config changes...')
7836
await vitest.waitForStdout('Waiting for file changes')
@@ -82,7 +40,7 @@ test('rerun stops the previous browser server and restarts multiple times withou
8240
vitest.resetOutput()
8341

8442
// editing the project the second time also restarts the server
85-
fs.editFile('./project-1/vitest.config.ts', c => `\n${c}`)
43+
fs.editFile('./project-1/vitest.config.js', c => `\n${c}`)
8644

8745
await vitest.waitForStdout('Restarting due to config changes...')
8846
await vitest.waitForStdout('Waiting for file changes')

0 commit comments

Comments
 (0)