Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
fix: file module cache not cleared in some cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 24, 2022
1 parent fc36016 commit 14adba6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/peeky-runner/src/runtime/run-test-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export async function runTestFile (options: RunTestFileOptions) {
options.clearDeps.forEach(file => {
moduleCache.delete(file)
moduleCache.delete(`/@fs/${file}`)
for (const key of moduleCache.keys()) {
const [start] = key.split('?')
if (file.includes(start)) {
moduleCache.delete(key)
}
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/peeky-server/src/schema/Run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export async function startRun (ctx: Context, id: string) {
const [suiteId, testId, snapshots] = message.args
const testFile = testSuites.find(s => s.id === suiteId).runTestFile.testFile
await updateTest(ctx, suiteId, testId, (test) => {
const list:SnapshotData[] = snapshots.map(s => toSnapshotData(s, test, testFile))
const list: SnapshotData[] = snapshots.map(s => toSnapshotData(s, test, testFile))
test.snapshots.push(...list)
addSnapshots(list)
return {
Expand Down

0 comments on commit 14adba6

Please sign in to comment.