Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/vitest/src/node/specifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class VitestSpecifications {
}

const forceRerunTriggers = this.vitest.config.forceRerunTriggers
const matcher = forceRerunTriggers.length ? pm(forceRerunTriggers) : undefined
const matcher = forceRerunTriggers.length ? pm(forceRerunTriggers, { dot: true }) : undefined
if (matcher && related.some(file => matcher(file))) {
return specs
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class VitestWatcher {
return false
}

if (pm.isMatch(filepath, this.vitest.config.forceRerunTriggers)) {
if (pm.isMatch(filepath, this.vitest.config.forceRerunTriggers, { dot: true })) {
this.vitest.state.getFilepaths().forEach(file => this.changedTests.add(file))
return true
}
Expand Down
15 changes: 15 additions & 0 deletions test/e2e/test/git-changed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ describe.skipIf(process.env.ECOSYSTEM_CI)('forceRerunTrigger', () => {
expect(stdout).not.toContain('not-related.test.ts')
})

it('should run the whole test suite if file exists in dot-directory trigger', async () => {
const dotFileName = 'fixtures/git-changed/related/.temp/rerun.temp'
createFile(dotFileName, '')
const { stdout, stderr } = await runVitest({
root: join(process.cwd(), 'fixtures/git-changed/related'),
include: ['related.test.ts'],
forceRerunTriggers: ['**/.temp/**'],
changed: true,
})
expect(stderr).toBe('')
expect(stdout).toContain('1 passed')
expect(stdout).toContain('related.test.ts')
expect(stdout).not.toContain('not-related.test.ts')
})

it('should run no tests if file does not exist', async () => {
const { stdout } = await run()
expect(stdout).toContain('No test files found, exiting with code 0')
Expand Down
Loading