From 1256b5ca34a36d3a29479d5dfddb129348964d80 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 25 Nov 2025 11:00:59 +0100 Subject: [PATCH] fix: rename `collect` to `import`, remove `prepare` (#9091) --- docs/guide/profiling-test-performance.md | 5 ++--- packages/vitest/src/node/reporters/base.ts | 4 +--- test/cli/test/artifacts.test.ts | 4 ++-- test/cli/test/no-unexpected-logging.test.ts | 2 +- test/reporters/tests/merge-reports.test.ts | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/guide/profiling-test-performance.md b/docs/guide/profiling-test-performance.md index 566816a35..ff4cf8b23 100644 --- a/docs/guide/profiling-test-performance.md +++ b/docs/guide/profiling-test-performance.md @@ -11,16 +11,15 @@ When you run Vitest it reports multiple time metrics of your tests: > Test Files 1 passed (1) > Tests 1 passed (1) > Start at 09:32:53 -> Duration 4.80s (transform 44ms, setup 0ms, collect 35ms, tests 4.52s, environment 0ms, prepare 81ms) +> Duration 4.80s (transform 44ms, setup 0ms, import 35ms, tests 4.52s, environment 0ms, prepare 81ms) > # Time metrics ^^ > ``` - Transform: How much time was spent transforming the files. See [File Transform](#file-transform). - Setup: Time spent for running the [`setupFiles`](/config/#setupfiles) files. -- Collect: Time spent for collecting all tests in the test files. This includes the time it took to import all file dependencies. +- Import: Time it took to import your test files and their dependencies. This also includes the time spent collecting all tests. Note that this doesn't include dynamic imports inside of tests. - Tests: Time spent for actually running the test cases. - Environment: Time spent for setting up the test [`environment`](/config/#environment), for example JSDOM. -- Prepare: Time Vitest uses to prepare the test runner. When running tests in Node, this is the time to import and execute all internal utilities inside the worker. When running tests in the browser, this also includes the time to initiate the iframe. ## Test runner diff --git a/packages/vitest/src/node/reporters/base.ts b/packages/vitest/src/node/reporters/base.ts index a36f39473..ac6fcf23a 100644 --- a/packages/vitest/src/node/reporters/base.ts +++ b/packages/vitest/src/node/reporters/base.ts @@ -587,17 +587,15 @@ export abstract class BaseReporter implements Reporter { const executionTime = blobs?.executionTimes ? sum(blobs.executionTimes, time => time) : this.end - this.start const environmentTime = sum(files, file => file.environmentLoad) - const prepareTime = sum(files, file => file.prepareDuration) const transformTime = this.ctx.state.transformTime const typecheck = sum(this.ctx.projects, project => project.typechecker?.getResult().time) const timers = [ `transform ${formatTime(transformTime)}`, `setup ${formatTime(setupTime)}`, - `collect ${formatTime(collectTime)}`, + `import ${formatTime(collectTime)}`, `tests ${formatTime(testsTime)}`, `environment ${formatTime(environmentTime)}`, - `prepare ${formatTime(prepareTime)}`, typecheck && `typecheck ${formatTime(typecheck)}`, ].filter(Boolean).join(', ') diff --git a/test/cli/test/artifacts.test.ts b/test/cli/test/artifacts.test.ts index d6ccb2802..c38f30f2d 100644 --- a/test/cli/test/artifacts.test.ts +++ b/test/cli/test/artifacts.test.ts @@ -380,7 +380,7 @@ describe('reporters', () => { Test Files 1 passed (1) Tests 2 passed (2) Start at