-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
07331ba
commit 4457ad0
Showing
2 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { expect, test } from 'vitest' | ||
import { runInlineTests } from '../../test-utils' | ||
|
||
test('reruns tests when config changes', async () => { | ||
const { vitest, ctx } = await runInlineTests({ | ||
'vitest.config.ts': ` | ||
process.stdin.isTTY = true | ||
process.stdin.setRawMode = () => process.stdin | ||
export default { | ||
test: { | ||
workspace: [ | ||
'./project-1', | ||
'./project-2', | ||
], | ||
}, | ||
}`, | ||
'project-1/vitest.config.ts': { test: { name: 'project-1' } }, | ||
'project-1/basic-1.test.ts': /* ts */` | ||
import { test } from 'vitest' | ||
test('basic test 1', () => {}) | ||
`, | ||
'project-2/vitest.config.ts': { test: { name: 'project-2' } }, | ||
'project-2/basic-2.test.ts': /* ts */` | ||
import { test } from 'vitest' | ||
test('basic test 2', () => {}) | ||
`, | ||
}, { watch: true }) | ||
|
||
await vitest.waitForStdout('Waiting for file changes') | ||
|
||
expect(vitest.stdout).toContain('2 passed') | ||
expect(vitest.stdout).toContain('basic-1.test.ts') | ||
expect(vitest.stdout).toContain('basic-2.test.ts') | ||
vitest.resetOutput() | ||
|
||
await ctx!.changeProjectName('project-2') | ||
|
||
await vitest.waitForStdout('Waiting for file changes') | ||
|
||
expect(vitest.stdout).toContain('1 passed') | ||
expect(vitest.stdout).toContain('basic-2.test.ts') | ||
}) |