diff --git a/docs/advanced/reporters.md b/docs/advanced/reporters.md index 2a486d622894..6a7e01d87c3c 100644 --- a/docs/advanced/reporters.md +++ b/docs/advanced/reporters.md @@ -93,7 +93,6 @@ class MyReporter implements Reporter { ### Built-in reporters: -1. `BasicReporter` 1. `DefaultReporter` 2. `DotReporter` 3. `JsonReporter` diff --git a/docs/guide/cli-generated.md b/docs/guide/cli-generated.md index a7ab176d6cfd..76f35e5450bd 100644 --- a/docs/guide/cli-generated.md +++ b/docs/guide/cli-generated.md @@ -89,7 +89,7 @@ Hide logs for skipped tests - **CLI:** `--reporter ` - **Config:** [reporters](/config/#reporters) -Specify reporters (default, basic, blob, verbose, dot, json, tap, tap-flat, junit, hanging-process, github-actions) +Specify reporters (default, blob, verbose, dot, json, tap, tap-flat, junit, hanging-process, github-actions) ### outputFile diff --git a/docs/guide/migration.md b/docs/guide/migration.md index 21b695a9f10d..b5f94265c3ab 100644 --- a/docs/guide/migration.md +++ b/docs/guide/migration.md @@ -5,6 +5,22 @@ outline: deep # Migration Guide +## Migrating to Vitest 4.0 {#vitest-4} + +### Removed `reporters: 'basic'` + +Basic reporter is removed as it is equal to: + +```ts +export default defineConfig({ + test: { + reporters: [ + ['default', { summary: false }] + ] + } +}) +``` + ## Migrating to Vitest 3.0 {#vitest-3} ### Test Options as a Third Argument diff --git a/docs/guide/reporters.md b/docs/guide/reporters.md index 748079f7acb9..9adc9df7e3cf 100644 --- a/docs/guide/reporters.md +++ b/docs/guide/reporters.md @@ -141,35 +141,6 @@ Final output after tests have finished: Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms) ``` -### Basic Reporter - -The `basic` reporter is equivalent to `default` reporter without `summary`. - -:::code-group -```bash [CLI] -npx vitest --reporter=basic -``` - -```ts [vitest.config.ts] -export default defineConfig({ - test: { - reporters: ['basic'] - }, -}) -``` -::: - -Example output using basic reporter: -```bash -✓ __tests__/file1.test.ts (2) 725ms -✓ __tests__/file2.test.ts (2) 746ms - - Test Files 2 passed (2) - Tests 4 passed (4) - Start at 12:34:32 - Duration 1.26s (transform 35ms, setup 1ms, collect 90ms, tests 1.47s, environment 0ms, prepare 267ms) -``` - ### Verbose Reporter Verbose reporter is same as `default` reporter, but it also displays each individual test after the suite has finished. It also displays currently running tests that are taking longer than [`slowTestThreshold`](/config/#slowtestthreshold). Similar to `default` reporter, you can disable the summary by configuring the reporter. @@ -228,7 +199,7 @@ Example of final terminal output for a passing test suite: ### Dot Reporter -Prints a single dot for each completed test to provide minimal output while still showing all tests that have run. Details are only provided for failed tests, along with the `basic` reporter summary for the suite. +Prints a single dot for each completed test to provide minimal output while still showing all tests that have run. Details are only provided for failed tests, along with the summary for the suite. :::code-group ```bash [CLI] diff --git a/packages/vitest/src/node/reporters/basic.ts b/packages/vitest/src/node/reporters/basic.ts deleted file mode 100644 index 9d6f4a5d5aa8..000000000000 --- a/packages/vitest/src/node/reporters/basic.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { File } from '@vitest/runner' -import type { Vitest } from '../core' -import { BaseReporter } from './base' - -export class BasicReporter extends BaseReporter { - constructor() { - super() - this.isTTY = false - } - - onInit(ctx: Vitest): void { - super.onInit(ctx) - - ctx.logger.deprecate( - `'basic' reporter is deprecated and will be removed in Vitest v3.\n` - + `Remove 'basic' from 'reporters' option. To match 'basic' reporter 100%, use configuration:\n${ - JSON.stringify({ test: { reporters: [['default', { summary: false }]] } }, null, 2)}`, - ) - } - - reportSummary(files: File[], errors: unknown[]): void { - // non-tty mode doesn't add a new line - this.ctx.logger.log() - return super.reportSummary(files, errors) - } -} diff --git a/packages/vitest/src/node/reporters/index.ts b/packages/vitest/src/node/reporters/index.ts index f7a56429e582..946d8a609918 100644 --- a/packages/vitest/src/node/reporters/index.ts +++ b/packages/vitest/src/node/reporters/index.ts @@ -5,7 +5,6 @@ import type { DefaultReporterOptions } from './default' import type { HTMLOptions } from './html' import type { JsonOptions } from './json' import type { JUnitOptions } from './junit' -import { BasicReporter } from './basic' import { BlobReporter } from './blob' import { DefaultReporter } from './default' import { DotReporter } from './dot' @@ -18,7 +17,6 @@ import { TapFlatReporter } from './tap-flat' import { VerboseReporter } from './verbose' export { - BasicReporter, DefaultReporter, DotReporter, GithubActionsReporter, @@ -45,7 +43,6 @@ export type { export const ReportersMap = { 'default': DefaultReporter as typeof DefaultReporter, - 'basic': BasicReporter as typeof BasicReporter, 'blob': BlobReporter as typeof BlobReporter, 'verbose': VerboseReporter as typeof VerboseReporter, 'dot': DotReporter as typeof DotReporter, @@ -61,7 +58,6 @@ export type BuiltinReporters = keyof typeof ReportersMap export interface BuiltinReporterOptions { 'default': DefaultReporterOptions - 'basic': BaseOptions 'verbose': DefaultReporterOptions 'dot': BaseOptions 'json': JsonOptions diff --git a/packages/vitest/src/node/reporters/utils.ts b/packages/vitest/src/node/reporters/utils.ts index 5ccc54b7b709..6e366a6c35c0 100644 --- a/packages/vitest/src/node/reporters/utils.ts +++ b/packages/vitest/src/node/reporters/utils.ts @@ -3,7 +3,7 @@ import type { Vitest } from '../core' import type { ResolvedConfig } from '../types/config' import type { Reporter } from '../types/reporter' import type { BlobReporter } from './blob' -import type { BasicReporter, BenchmarkBuiltinReporters, BenchmarkReporter, BuiltinReporters, DefaultReporter, DotReporter, GithubActionsReporter, HangingProcessReporter, JsonReporter, JUnitReporter, TapReporter } from './index' +import type { BenchmarkBuiltinReporters, BenchmarkReporter, BuiltinReporters, DefaultReporter, DotReporter, GithubActionsReporter, HangingProcessReporter, JsonReporter, JUnitReporter, TapReporter } from './index' import { BenchmarkReportsMap, ReportersMap } from './index' async function loadCustomReporterModule( @@ -35,7 +35,7 @@ async function loadCustomReporterModule( function createReporters( reporterReferences: ResolvedConfig['reporters'], ctx: Vitest, -): Promise> { +): Promise> { const runner = ctx.runner const promisedReporters = reporterReferences.map( async (referenceOrInstance) => { diff --git a/packages/vitest/src/public/reporters.ts b/packages/vitest/src/public/reporters.ts index 0a4ccea55457..b10c9791a9b3 100644 --- a/packages/vitest/src/public/reporters.ts +++ b/packages/vitest/src/public/reporters.ts @@ -1,5 +1,4 @@ export { - BasicReporter, BenchmarkReporter, BenchmarkReportsMap, DefaultReporter, diff --git a/test/config/test/retry.test.ts b/test/config/test/retry.test.ts index f2940fe4cd0b..7fbfc8274547 100644 --- a/test/config/test/retry.test.ts +++ b/test/config/test/retry.test.ts @@ -5,7 +5,6 @@ function run(testNamePattern: string) { return runVitest({ include: ['fixtures/retry/retry.test.ts'], config: 'fixtures/retry/vitest.config.ts', - reporters: ['basic'], testNamePattern, }) } diff --git a/test/core/test/exports.test.ts b/test/core/test/exports.test.ts index 09387a1d3877..2fdcfaba75c0 100644 --- a/test/core/test/exports.test.ts +++ b/test/core/test/exports.test.ts @@ -121,7 +121,6 @@ it('exports snapshot', async ({ skip, task }) => { "viteVersion": "string", }, "./reporters": { - "BasicReporter": "function", "BenchmarkReporter": "function", "BenchmarkReportsMap": "object", "DefaultReporter": "function", @@ -278,7 +277,6 @@ it('exports snapshot', async ({ skip, task }) => { "viteVersion": "string", }, "./reporters": { - "BasicReporter": "function", "BenchmarkReporter": "function", "BenchmarkReportsMap": "object", "DefaultReporter": "function", diff --git a/test/reporters/tests/configuration-options.test-d.ts b/test/reporters/tests/configuration-options.test-d.ts index b1c6c8ecc5ba..1890eebdd610 100644 --- a/test/reporters/tests/configuration-options.test-d.ts +++ b/test/reporters/tests/configuration-options.test-d.ts @@ -5,7 +5,6 @@ type NarrowToTestConfig = T extends { test?: any } ? NonNullable : type Configuration = NonNullable[0])>> test('reporters, single', () => { - assertType({ reporters: 'basic' }) assertType({ reporters: 'default' }) assertType({ reporters: 'dot' }) assertType({ reporters: 'hanging-process' }) @@ -24,7 +23,6 @@ test('reporters, single', () => { test('reporters, multiple', () => { assertType({ reporters: [ - 'basic', 'default', 'dot', 'hanging-process', diff --git a/test/watch/test/reporter-failed.test.ts b/test/watch/test/reporter-failed.test.ts index 4294eddaa528..0590db3c1e15 100644 --- a/test/watch/test/reporter-failed.test.ts +++ b/test/watch/test/reporter-failed.test.ts @@ -4,7 +4,6 @@ import { editFile, runVitest } from '../../test-utils' describe.each([ ['default', true], ['default', false], - ['basic', false], ])('%s reporter with %s tty', (reporter, isTTY) => { it('prints previously failed tests on rerun', async () => { const { vitest } = await runVitest({