-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vitest): test deep dependencies change detection
`--changed` flag is not correctly looking up deep dependencies, as such the changed flag does not trigger specs if a sub dependency is changed. Alters the logic to add the collected dependency after recursive `addImports` is called, otherwise the logic returns early because that dependency has already been added to the collected deps set. So it will not look deeply.
- Loading branch information
1 parent
9ec3f74
commit 89678fc
Showing
6 changed files
with
35 additions
and
5 deletions.
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
11 changes: 11 additions & 0 deletions
11
test/changed/fixtures/related/deep-related-exports.test.ts
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,11 @@ | ||
import { access } from 'node:fs' | ||
import { sep } from 'pathe' | ||
import { expect, test } from 'vitest' | ||
import { A } from './src/sourceC' | ||
|
||
test('values', () => { | ||
expect(A).toBe('A') | ||
expect(typeof sep).toBe('string') | ||
// doesn't throw | ||
expect(typeof access).toBe('function') | ||
}) |
11 changes: 11 additions & 0 deletions
11
test/changed/fixtures/related/deep-related-imports.test.ts
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,11 @@ | ||
import { access } from 'node:fs' | ||
import { sep } from 'pathe' | ||
import { expect, test } from 'vitest' | ||
import { A } from './src/sourceD' | ||
|
||
test('values', () => { | ||
expect(A).toBe('A') | ||
expect(typeof sep).toBe('string') | ||
// doesn't throw | ||
expect(typeof access).toBe('function') | ||
}) |
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,2 @@ | ||
// re-exporting for deep changed detection | ||
export { A } from './sourceA' |
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,4 @@ | ||
// import and re-exporting for deep changed detection | ||
import { A as sourceA } from './sourceA' | ||
|
||
export const A = sourceA |
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