[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
12

Configure Feed

Select the types of activity you want to include in your feed.

feat: reprint all tests, if one of the test files was deleted (#1081)

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>

authored by

Vladimir
Anthony Fu
and committed by
GitHub
(Apr 3, 2022, 8:16 AM UTC) 2ded6246 3c965d4e

+14
+1
packages/vitest/src/node/core.ts
··· 329 329 if (this.state.filesMap.has(id)) { 330 330 this.state.filesMap.delete(id) 331 331 this.changedTests.delete(id) 332 + this.report('onTestRemoved', id) 332 333 } 333 334 } 334 335 const onAdd = async(id: string) => {
+1
packages/vitest/src/types/reporter.ts
··· 8 8 onFinished?: (files?: File[]) => Awaitable<void> 9 9 onTaskUpdate?: (packs: TaskResultPack[]) => Awaitable<void> 10 10 11 + onTestRemoved?: (trigger?: string) => Awaitable<void> 11 12 onWatcherStart?: () => Awaitable<void> 12 13 onWatcherRerun?: (files: string[], trigger?: string) => Awaitable<void> 13 14
+12
packages/vitest/src/node/reporters/default.ts
··· 1 + import c from 'picocolors' 1 2 import type { UserConsoleLog } from '../../types' 2 3 import { BaseReporter } from './base' 3 4 import type { ListRendererOptions } from './renderers/listRenderer' ··· 6 7 export class DefaultReporter extends BaseReporter { 7 8 renderer?: ReturnType<typeof createListRenderer> 8 9 rendererOptions: ListRendererOptions = {} as any 10 + 11 + async onTestRemoved(trigger?: string) { 12 + await this.stopListRender() 13 + this.ctx.console.clear() 14 + this.ctx.log(c.yellow('Test removed...') + (trigger ? c.dim(` [ ${this.relative(trigger)} ]\n`) : '')) 15 + const files = this.ctx.state.getFiles(this.watchFilters) 16 + createListRenderer(files, this.rendererOptions).stop() 17 + this.ctx.log() 18 + await super.reportSummary(files) 19 + super.onWatcherStart() 20 + } 9 21 10 22 onCollected() { 11 23 if (this.isTTY) {