Skip to content
Merged
Changes from 2 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
18 changes: 12 additions & 6 deletions packages/vitest/src/node/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,13 +1071,19 @@ export class Vitest {
throw new Error(`Task ${id} was not found`)
}

const taskNamePattern = task.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const specification = this.state.getReportedEntityById(id)?.toTestSpecification()
if (!specification) {
throw new Error(`Test specification for task ${id} was not found`)
}

await this.changeNamePattern(
taskNamePattern,
[task.file.filepath],
'tasks' in task ? 'rerun suite' : 'rerun test',
)
const specifications = [specification]
const files = [task.file.filepath]
await Promise.all([
this.report('onWatcherRerun', files, 'tasks' in task ? 'rerun suite' : 'rerun test'),
...this._onUserTestsRerun.map(fn => fn(specifications)),
])
await this.runFiles(specifications, false)
await this.report('onWatcherStart', this.state.getFiles(files))
Comment thread
userquin marked this conversation as resolved.
Outdated
}

/** @internal */
Expand Down
Loading