Skip to content
Merged
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
4 changes: 4 additions & 0 deletions packages/ui/client/composables/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ function clearTaskResult(task: RunnerTask) {
const node = explorerTree.nodes.get(task.id)
if (node) {
node.state = undefined
// update task mode to allow change icon on skipped tests
task.mode = 'run'
node.duration = undefined
if (isTaskSuite(task)) {
for (const t of task.tasks) {
Expand All @@ -113,13 +115,15 @@ function clearResults(useFiles: RunnerTestFile[]) {
const task = map.get(i.id)
if (task) {
task.state = undefined
task.mode = 'run'
task.duration = undefined
}
}
})
const file = map.get(f.id)
if (file) {
file.state = undefined
file.mode = 'run'
file.duration = undefined
if (isFileNode(file)) {
file.collectDuration = undefined
Expand Down
22 changes: 17 additions & 5 deletions packages/vitest/src/node/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,12 +1071,24 @@ export class Vitest {
throw new Error(`Task ${id} was not found`)
}

const taskNamePattern = task.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
const reportedTask = this.state.getReportedEntityById(id)
if (!reportedTask) {
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 = [reportedTask.toTestSpecification()]
await Promise.all([
this.report(
'onWatcherRerun',
[task.file.filepath],
'tasks' in task ? 'rerun suite' : 'rerun test',
),
...this._onUserTestsRerun.map(fn => fn(specifications)),
])
await this.runFiles(specifications, false)
await this.report(
'onWatcherStart',
['module' in reportedTask ? reportedTask.module.task : reportedTask.task],
)
}

Expand Down
Loading