Skip to content

Commit 66bee83

Browse files
authored
fix!: remove deprecated types (#8203)
1 parent cb8b03b commit 66bee83

File tree

15 files changed

+8
-76
lines changed

15 files changed

+8
-76
lines changed

packages/runner/src/map.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import type { Awaitable } from '@vitest/utils'
22
import type { FixtureItem } from './fixture'
3-
import type { Custom, Suite, SuiteHooks, Test, TestContext } from './types/tasks'
3+
import type { Suite, SuiteHooks, Test, TestContext } from './types/tasks'
44

55
// use WeakMap here to make the Test and Suite object serializable
66
const fnMap = new WeakMap()
77
const testFixtureMap = new WeakMap()
88
const hooksMap = new WeakMap()
99

10-
export function setFn(key: Test | Custom, fn: () => Awaitable<void>): void {
10+
export function setFn(key: Test, fn: () => Awaitable<void>): void {
1111
fnMap.set(key, fn)
1212
}
1313

14-
export function getFn<Task = Test | Custom>(key: Task): () => Awaitable<void> {
14+
export function getFn<Task = Test>(key: Task): () => Awaitable<void> {
1515
return fnMap.get(key as any)
1616
}
1717

packages/runner/src/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ export type {
1111
AfterEachListener,
1212
BeforeAllListener,
1313
BeforeEachListener,
14-
Custom,
15-
/** @deprecated use `TestAPI` instead */
16-
CustomAPI,
17-
DoneCallback,
18-
ExtendedContext,
1914
File,
2015
Fixture,
2116
FixtureFn,
@@ -38,7 +33,6 @@ export type {
3833
SuiteHooks,
3934
Task,
4035
TaskBase,
41-
TaskContext,
4236
TaskCustomOptions,
4337
TaskEventPack,
4438
TaskHook,

packages/runner/src/types/tasks.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,8 @@ export interface TestAnnotation {
297297
attachment?: TestAttachment
298298
}
299299

300-
/**
301-
* @deprecated Use `Test` instead. `type: 'custom'` is not used since 2.2
302-
*/
303-
export type Custom<ExtraContext = object> = Test<ExtraContext>
304-
305300
export type Task = Test | Suite | File
306301

307-
/**
308-
* @deprecated Vitest doesn't provide `done()` anymore
309-
*/
310-
export type DoneCallback = (error?: any) => void
311302
export type TestFunction<ExtraContext = object> = (
312303
context: TestContext & ExtraContext
313304
) => Awaitable<any> | void
@@ -517,9 +508,6 @@ export type TestAPI<ExtraContext = object> = ChainableTestAPI<ExtraContext> &
517508
) => void
518509
}
519510

520-
/** @deprecated use `TestAPI` instead */
521-
export type { TestAPI as CustomAPI }
522-
523511
export interface FixtureOptions {
524512
/**
525513
* Whether to automatically set up current fixture, even though it's not being used in tests.
@@ -743,15 +731,6 @@ export interface TestContext {
743731
}
744732
}
745733

746-
/**
747-
* Context that's always available in the test function.
748-
* @deprecated use `TestContext` instead
749-
*/
750-
export interface TaskContext extends TestContext {}
751-
752-
/** @deprecated use `TestContext` instead */
753-
export type ExtendedContext = TaskContext & TestContext
754-
755734
export type OnTestFailedHandler = (context: TestContext) => Awaitable<void>
756735
export type OnTestFinishedHandler = (context: TestContext) => Awaitable<void>
757736

packages/vitest/src/api/setup.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ export function setup(ctx: Vitest, _server?: ViteDevServer): void {
8888
getConfig() {
8989
return ctx.getRootProject().serializedConfig
9090
},
91-
getResolvedProjectNames(): string[] {
92-
return ctx.projects.map(p => p.name)
93-
},
9491
getResolvedProjectLabels(): { name: string; color?: LabelColor }[] {
9592
return ctx.projects.map(p => ({ name: p.name, color: p.color }))
9693
},

packages/vitest/src/api/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ export interface WebSocketHandlers {
3232
getTestFiles: () => Promise<SerializedTestSpecification[]>
3333
getPaths: () => string[]
3434
getConfig: () => SerializedConfig
35-
// TODO: Remove in v4
36-
/** @deprecated -- Use `getResolvedProjectLabels` instead */
37-
getResolvedProjectNames: () => string[]
3835
getResolvedProjectLabels: () => { name: string; color?: LabelColor }[]
3936
getModuleGraph: (
4037
projectName: string,

packages/vitest/src/node/globalSetup.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import type { ViteNodeRunner } from 'vite-node/client'
22
import type { TestProject } from './project'
33
import { toArray } from '@vitest/utils'
44

5-
/** @deprecated use `TestProject` instead */
6-
export type GlobalSetupContext = TestProject
7-
85
export interface GlobalSetupFile {
96
file: string
107
setup?: (context: TestProject) => Promise<Function | void> | void

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ interface ClassnameTemplateVariables {
1818

1919
export interface JUnitOptions {
2020
outputFile?: string
21-
/** @deprecated Use `classnameTemplate` instead. */
22-
classname?: string
2321

2422
/**
2523
* Template for the classname attribute. Can be either a string or a function. The string can contain placeholders {filename} and {filepath}.
@@ -221,9 +219,6 @@ export class JUnitReporter implements Reporter {
221219
.replace(/\{filename\}/g, templateVars.filename)
222220
.replace(/\{filepath\}/g, templateVars.filepath)
223221
}
224-
else if (typeof this.options.classname === 'string') {
225-
classname = this.options.classname
226-
}
227222

228223
await this.writeElement(
229224
'testcase',

packages/vitest/src/node/types/browser.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@ export interface BrowserCommandContext {
242242
testPath: string | undefined
243243
provider: BrowserProvider
244244
project: TestProject
245-
/** @deprecated use `sessionId` instead */
246-
contextId: string
247245
sessionId: string
248246
}
249247

packages/vitest/src/public/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ export {
8383
test,
8484
} from '@vitest/runner'
8585
export type {
86-
ExtendedContext,
8786
HookCleanupCallback,
8887
HookListener,
8988
ImportDuration,
9089
OnTestFailedHandler,
9190
OnTestFinishedHandler,
9291
RunMode,
93-
Custom as RunnerCustomCase,
9492
Task as RunnerTask,
9593
TaskBase as RunnerTaskBase,
9694
TaskEventPack as RunnerTaskEventPack,
@@ -102,7 +100,6 @@ export type {
102100
SuiteAPI,
103101
SuiteCollector,
104102
SuiteFactory,
105-
TaskContext,
106103
TaskCustomOptions,
107104
TaskMeta,
108105
TaskState,

packages/vitest/src/public/node.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export type {
1616
} from '../node/core'
1717
export { createVitest } from '../node/create'
1818
export { GitNotFoundError, FilesNotFoundError as TestsNotFoundError } from '../node/errors'
19-
export type { GlobalSetupContext } from '../node/globalSetup'
2019
export { VitestPackageInstaller } from '../node/packageInstaller'
2120
export { VitestPlugin } from '../node/plugins'
2221
export { resolveConfig } from '../node/plugins/publicConfig'

0 commit comments

Comments
 (0)