Skip to content

Commit 5c308ed

Browse files
authored
feat: remove deprecated options (#5696)
1 parent 1db23d0 commit 5c308ed

File tree

10 files changed

+17
-32
lines changed

10 files changed

+17
-32
lines changed

packages/ui/node/reporter.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ import c from 'picocolors'
77
import fg from 'fast-glob'
88
import { stringify } from 'flatted'
99
import type { File, ModuleGraphData, Reporter, ResolvedConfig, Vitest } from 'vitest'
10+
import type { HTMLOptions } from 'vitest/node'
1011
import { getModuleGraph } from '../../vitest/src/utils/graph'
1112

12-
export interface HTMLOptions {
13-
outputFile?: string
14-
}
15-
1613
interface PotentialConfig {
1714
outputFile?: string | Partial<Record<string, string>>
1815
}

packages/vitest/src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export * from './integrations/chai'
1717
export * from './integrations/vi'
1818
export * from './integrations/utils'
1919
export { inject } from './integrations/inject'
20-
// TODO: remove in 2.0.0, import from vitest/snapshot directly
21-
export type { SnapshotEnvironment } from '@vitest/snapshot/environment'
2220

2321
export * from './types'
2422
export * from './api/types'

packages/vitest/src/node/cli/cac.ts

-7
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@ export function createCLI(options: CLIOptions = {}) {
167167
benchCliOptionsConfig,
168168
)
169169

170-
// TODO: remove in Vitest 2.0
171-
cli
172-
.command('typecheck [...filters]')
173-
.action(() => {
174-
throw new Error(`Running typecheck via "typecheck" command is removed. Please use "--typecheck" to run your regular tests alongside typechecking, or "--typecheck.only" to run only typecheck tests.`)
175-
})
176-
177170
cli
178171
.command('[...filters]', undefined, options)
179172
.action((filters, options) => start('test', filters, options))

packages/vitest/src/node/config.ts

-5
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,6 @@ export function resolveConfig(
167167
}
168168
}
169169

170-
// TODO: V2.0.0 remove
171-
// @ts-expect-error -- check for removed API option
172-
if (resolved.coverage.provider === 'c8')
173-
throw new Error('"coverage.provider: c8" is not supported anymore. Use "coverage.provider: v8" instead')
174-
175170
if (resolved.coverage.provider === 'v8' && resolved.coverage.enabled && isBrowserEnabled(resolved))
176171
throw new Error('@vitest/coverage-v8 does not work with --browser. Use @vitest/coverage-istanbul instead')
177172

packages/vitest/src/node/index.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,12 @@ export { VitestPackageInstaller } from './packageInstaller'
1313
export type { TestSequencer, TestSequencerConstructor } from './sequencers/types'
1414
export { BaseSequencer } from './sequencers/BaseSequencer'
1515

16-
export type { BrowserProviderInitializationOptions, BrowserProvider, BrowserProviderOptions, BrowserScript } from '../types/browser'
16+
export type {
17+
BrowserProviderInitializationOptions,
18+
BrowserProvider,
19+
BrowserProviderOptions,
20+
BrowserScript,
21+
} from '../types/browser'
22+
export type { JsonOptions } from './reporters/json'
23+
export type { JUnitOptions } from './reporters/junit'
24+
export type { HTMLOptions } from './reporters/html'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface HTMLOptions {
2+
outputFile?: string
3+
}

packages/vitest/src/node/reporters/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { TapFlatReporter } from './tap-flat'
1010
import { HangingProcessReporter } from './hanging-process'
1111
import { GithubActionsReporter } from './github-actions'
1212
import type { BaseReporter } from './base'
13+
import type { HTMLOptions } from './html'
1314

1415
export {
1516
DefaultReporter,
@@ -52,7 +53,7 @@ export interface BuiltinReporterOptions {
5253
'tap-flat': never
5354
'junit': JUnitOptions
5455
'hanging-process': never
55-
'html': { outputFile?: string } // TODO: Any better place for defining this UI package's reporter options?
56+
'html': HTMLOptions
5657
}
5758

5859
export * from './benchmark'

packages/vitest/src/node/reporters/junit.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ export class JUnitReporter implements Reporter {
169169
async writeTasks(tasks: Task[], filename: string): Promise<void> {
170170
for (const task of tasks) {
171171
await this.writeElement('testcase', {
172-
// TODO: v2.0.0 Remove env variable in favor of custom reporter options, e.g. "reporters: [['json', { classname: 'something' }]]"
173-
classname: this.options.classname ?? process.env.VITEST_JUNIT_CLASSNAME ?? filename,
172+
classname: this.options.classname ?? filename,
174173
file: this.options.addFileAttribute ? filename : undefined,
175174
name: task.name,
176175
time: getDuration(task),
@@ -264,8 +263,7 @@ export class JUnitReporter implements Reporter {
264263
stats.failures += file.stats.failures
265264
return stats
266265
}, {
267-
// TODO: v2.0.0 Remove env variable in favor of custom reporter options, e.g. "reporters: [['json', { suiteName: 'something' }]]"
268-
name: this.options.suiteName || process.env.VITEST_JUNIT_SUITE_NAME || 'vitest tests',
266+
name: this.options.suiteName || 'vitest tests',
269267
tests: 0,
270268
failures: 0,
271269
errors: 0, // we cannot detect those

packages/vitest/src/types/config.ts

-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ export interface InlineConfig {
391391
*/
392392
reporters?: Arrayable<ReporterName | InlineReporter> | ((ReporterName | InlineReporter) | [ReporterName] | ReporterWithOptions)[]
393393

394-
// TODO: v2.0.0 Remove in favor of custom reporter options, e.g. "reporters: [['json', { outputFile: 'some-dir/file.html' }]]"
395394
/**
396395
* Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
397396
* Also definable individually per reporter by using an object instead.

test/config/test/failures.test.ts

-7
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ test('inspect-brk cannot be used with multi processing', async () => {
4949
expect(stderr).toMatch('Error: You cannot use --inspect without "--no-file-parallelism", "poolOptions.threads.singleThread" or "poolOptions.forks.singleFork"')
5050
})
5151

52-
test('c8 coverage provider is not supported', async () => {
53-
// @ts-expect-error -- check for removed API option
54-
const { stderr } = await runVitest({ coverage: { enabled: true, provider: 'c8' } })
55-
56-
expect(stderr).toMatch('Error: "coverage.provider: c8" is not supported anymore. Use "coverage.provider: v8" instead')
57-
})
58-
5952
test('v8 coverage provider cannot be used with browser', async () => {
6053
const { stderr } = await runVitest({ coverage: { enabled: true }, browser: { enabled: true, name: 'chrome' } })
6154

0 commit comments

Comments
 (0)