@vitest/runner 3.0.8 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +219 -219
- package/dist/index.js +70 -17
- package/dist/tasks.d-D4e98wjH.d.ts +484 -0
- package/dist/types.d.ts +130 -130
- package/dist/utils.d.ts +18 -15
- package/package.json +2 -2
- package/dist/tasks-CPSpEF1h.d.ts +0 -485
package/dist/types.d.ts
CHANGED
@@ -1,145 +1,145 @@
|
|
1
1
|
import { DiffOptions } from '@vitest/utils/diff';
|
2
|
-
import { F as File, T as Task, a as Test, S as Suite, K as TaskResultPack, y as TaskEventPack, M as TestContext, s as SequenceHooks, t as SequenceSetupFiles } from './tasks-
|
3
|
-
export { A as AfterAllListener, b as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, g as Custom, j as CustomAPI, D as DoneCallback, E as ExtendedContext, m as Fixture, n as FixtureFn, o as FixtureOptions, p as Fixtures, H as HookCleanupCallback, q as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, f as OnTestFinishedHandler, R as RunMode, r as RuntimeContext, k as SuiteAPI, l as SuiteCollector, u as SuiteFactory, h as SuiteHooks, v as TaskBase, w as TaskContext, x as TaskCustomOptions, e as TaskHook, z as TaskMeta, G as TaskPopulated, J as TaskResult, L as TaskState, i as TaskUpdateEvent, j as TestAPI, N as TestFunction, P as TestOptions, U as Use } from './tasks-
|
2
|
+
import { F as File, T as Task, a as Test, S as Suite, K as TaskResultPack, y as TaskEventPack, M as TestContext, s as SequenceHooks, t as SequenceSetupFiles } from './tasks.d-D4e98wjH.js';
|
3
|
+
export { A as AfterAllListener, b as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, g as Custom, j as CustomAPI, D as DoneCallback, E as ExtendedContext, m as Fixture, n as FixtureFn, o as FixtureOptions, p as Fixtures, H as HookCleanupCallback, q as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, f as OnTestFinishedHandler, R as RunMode, r as RuntimeContext, k as SuiteAPI, l as SuiteCollector, u as SuiteFactory, h as SuiteHooks, v as TaskBase, w as TaskContext, x as TaskCustomOptions, e as TaskHook, z as TaskMeta, G as TaskPopulated, J as TaskResult, L as TaskState, i as TaskUpdateEvent, j as TestAPI, N as TestFunction, P as TestOptions, U as Use } from './tasks.d-D4e98wjH.js';
|
4
4
|
import '@vitest/utils';
|
5
5
|
|
6
6
|
/**
|
7
|
-
|
8
|
-
|
7
|
+
* This is a subset of Vitest config that's required for the runner to work.
|
8
|
+
*/
|
9
9
|
interface VitestRunnerConfig {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
10
|
+
root: string;
|
11
|
+
setupFiles: string[];
|
12
|
+
name?: string;
|
13
|
+
passWithNoTests: boolean;
|
14
|
+
testNamePattern?: RegExp;
|
15
|
+
allowOnly?: boolean;
|
16
|
+
sequence: {
|
17
|
+
shuffle?: boolean
|
18
|
+
concurrent?: boolean
|
19
|
+
seed: number
|
20
|
+
hooks: SequenceHooks
|
21
|
+
setupFiles: SequenceSetupFiles
|
22
|
+
};
|
23
|
+
chaiConfig?: {
|
24
|
+
truncateThreshold?: number
|
25
|
+
};
|
26
|
+
maxConcurrency: number;
|
27
|
+
testTimeout: number;
|
28
|
+
hookTimeout: number;
|
29
|
+
retry: number;
|
30
|
+
includeTaskLocation?: boolean;
|
31
|
+
diffOptions?: DiffOptions;
|
32
32
|
}
|
33
33
|
/**
|
34
|
-
|
35
|
-
|
34
|
+
* Possible options to run a single file in a test.
|
35
|
+
*/
|
36
36
|
interface FileSpecification {
|
37
|
-
|
38
|
-
|
37
|
+
filepath: string;
|
38
|
+
testLocations: number[] | undefined;
|
39
39
|
}
|
40
|
-
type VitestRunnerImportSource =
|
40
|
+
type VitestRunnerImportSource = "collect" | "setup";
|
41
41
|
interface VitestRunnerConstructor {
|
42
|
-
|
42
|
+
new (config: VitestRunnerConfig): VitestRunner;
|
43
43
|
}
|
44
|
-
type CancelReason =
|
44
|
+
type CancelReason = "keyboard-input" | "test-failure" | (string & Record<string, never>);
|
45
45
|
interface VitestRunner {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
46
|
+
/**
|
47
|
+
* First thing that's getting called before actually collecting and running tests.
|
48
|
+
*/
|
49
|
+
onBeforeCollect?: (paths: string[]) => unknown;
|
50
|
+
/**
|
51
|
+
* Called after the file task was created but not collected yet.
|
52
|
+
*/
|
53
|
+
onCollectStart?: (file: File) => unknown;
|
54
|
+
/**
|
55
|
+
* Called after collecting tests and before "onBeforeRun".
|
56
|
+
*/
|
57
|
+
onCollected?: (files: File[]) => unknown;
|
58
|
+
/**
|
59
|
+
* Called when test runner should cancel next test runs.
|
60
|
+
* Runner should listen for this method and mark tests and suites as skipped in
|
61
|
+
* "onBeforeRunSuite" and "onBeforeRunTask" when called.
|
62
|
+
*/
|
63
|
+
onCancel?: (reason: CancelReason) => unknown;
|
64
|
+
/**
|
65
|
+
* Called before running a single test. Doesn't have "result" yet.
|
66
|
+
*/
|
67
|
+
onBeforeRunTask?: (test: Task) => unknown;
|
68
|
+
/**
|
69
|
+
* Called before actually running the test function. Already has "result" with "state" and "startTime".
|
70
|
+
*/
|
71
|
+
onBeforeTryTask?: (test: Task, options: {
|
72
|
+
retry: number
|
73
|
+
repeats: number
|
74
|
+
}) => unknown;
|
75
|
+
/**
|
76
|
+
* When the task has finished running, but before cleanup hooks are called
|
77
|
+
*/
|
78
|
+
onTaskFinished?: (test: Test) => unknown;
|
79
|
+
/**
|
80
|
+
* Called after result and state are set.
|
81
|
+
*/
|
82
|
+
onAfterRunTask?: (test: Task) => unknown;
|
83
|
+
/**
|
84
|
+
* Called right after running the test function. Doesn't have new state yet. Will not be called, if the test function throws.
|
85
|
+
*/
|
86
|
+
onAfterTryTask?: (test: Task, options: {
|
87
|
+
retry: number
|
88
|
+
repeats: number
|
89
|
+
}) => unknown;
|
90
|
+
/**
|
91
|
+
* Called before running a single suite. Doesn't have "result" yet.
|
92
|
+
*/
|
93
|
+
onBeforeRunSuite?: (suite: Suite) => unknown;
|
94
|
+
/**
|
95
|
+
* Called after running a single suite. Has state and result.
|
96
|
+
*/
|
97
|
+
onAfterRunSuite?: (suite: Suite) => unknown;
|
98
|
+
/**
|
99
|
+
* If defined, will be called instead of usual Vitest suite partition and handling.
|
100
|
+
* "before" and "after" hooks will not be ignored.
|
101
|
+
*/
|
102
|
+
runSuite?: (suite: Suite) => Promise<void>;
|
103
|
+
/**
|
104
|
+
* If defined, will be called instead of usual Vitest handling. Useful, if you have your custom test function.
|
105
|
+
* "before" and "after" hooks will not be ignored.
|
106
|
+
*/
|
107
|
+
runTask?: (test: Task) => Promise<void>;
|
108
|
+
/**
|
109
|
+
* Called, when a task is updated. The same as "onTaskUpdate" in a reporter, but this is running in the same thread as tests.
|
110
|
+
*/
|
111
|
+
onTaskUpdate?: (task: TaskResultPack[], events: TaskEventPack[]) => Promise<void>;
|
112
|
+
/**
|
113
|
+
* Called before running all tests in collected paths.
|
114
|
+
*/
|
115
|
+
onBeforeRunFiles?: (files: File[]) => unknown;
|
116
|
+
/**
|
117
|
+
* Called right after running all tests in collected paths.
|
118
|
+
*/
|
119
|
+
onAfterRunFiles?: (files: File[]) => unknown;
|
120
|
+
/**
|
121
|
+
* Called when new context for a test is defined. Useful if you want to add custom properties to the context.
|
122
|
+
* If you only want to define custom context, consider using "beforeAll" in "setupFiles" instead.
|
123
|
+
*
|
124
|
+
* @see https://vitest.dev/advanced/runner#your-task-function
|
125
|
+
*/
|
126
|
+
extendTaskContext?: (context: TestContext) => TestContext;
|
127
|
+
/**
|
128
|
+
* Called when test and setup files are imported. Can be called in two situations: when collecting tests and when importing setup files.
|
129
|
+
*/
|
130
|
+
importFile: (filepath: string, source: VitestRunnerImportSource) => unknown;
|
131
|
+
/**
|
132
|
+
* Function that is called when the runner attempts to get the value when `test.extend` is used with `{ injected: true }`
|
133
|
+
*/
|
134
|
+
injectValue?: (key: string) => unknown;
|
135
|
+
/**
|
136
|
+
* Publicly available configuration.
|
137
|
+
*/
|
138
|
+
config: VitestRunnerConfig;
|
139
|
+
/**
|
140
|
+
* The name of the current pool. Can affect how stack trace is inferred on the server side.
|
141
|
+
*/
|
142
|
+
pool?: string;
|
143
143
|
}
|
144
144
|
|
145
145
|
export { type CancelReason, File, type FileSpecification, SequenceHooks, SequenceSetupFiles, Suite, Task, TaskEventPack, TaskResultPack, Test, TestContext, type VitestRunner, type VitestRunnerConfig, type VitestRunnerConstructor, type VitestRunnerImportSource };
|
package/dist/utils.d.ts
CHANGED
@@ -1,35 +1,38 @@
|
|
1
|
-
import { S as Suite, F as File, T as Task, a as Test } from './tasks-
|
2
|
-
export { C as ChainableFunction, c as createChainable } from './tasks-
|
1
|
+
import { S as Suite, F as File, T as Task, a as Test } from './tasks.d-D4e98wjH.js';
|
2
|
+
export { C as ChainableFunction, c as createChainable } from './tasks.d-D4e98wjH.js';
|
3
3
|
import { Arrayable } from '@vitest/utils';
|
4
4
|
|
5
5
|
/**
|
6
|
-
|
7
|
-
|
6
|
+
* If any tasks been marked as `only`, mark all other tasks as `skip`.
|
7
|
+
*/
|
8
8
|
declare function interpretTaskModes(file: Suite, namePattern?: string | RegExp, testLocations?: number[] | undefined, onlyMode?: boolean, parentIsOnly?: boolean, allowOnly?: boolean): void;
|
9
9
|
declare function someTasksAreOnly(suite: Suite): boolean;
|
10
10
|
declare function generateHash(str: string): string;
|
11
11
|
declare function calculateSuiteHash(parent: Suite): void;
|
12
12
|
declare function createFileTask(filepath: string, root: string, projectName: string | undefined, pool?: string): File;
|
13
13
|
/**
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
* Generate a unique ID for a file based on its path and project name
|
15
|
+
* @param file File relative to the root of the project to keep ID the same between different machines
|
16
|
+
* @param projectName The name of the test project
|
17
|
+
*/
|
18
18
|
declare function generateFileHash(file: string, projectName: string | undefined): string;
|
19
19
|
|
20
20
|
/**
|
21
|
-
|
22
|
-
|
23
|
-
declare function limitConcurrency(concurrency?: number): <
|
21
|
+
* Return a function for running multiple async operations with limited concurrency.
|
22
|
+
*/
|
23
|
+
declare function limitConcurrency(concurrency?: number): <
|
24
|
+
Args extends unknown[],
|
25
|
+
T
|
26
|
+
>(func: (...args: Args) => PromiseLike<T> | T, ...args: Args) => Promise<T>;
|
24
27
|
|
25
28
|
/**
|
26
|
-
|
27
|
-
|
29
|
+
* Partition in tasks groups by consecutive concurrent
|
30
|
+
*/
|
28
31
|
declare function partitionSuiteChildren(suite: Suite): Task[][];
|
29
32
|
|
30
33
|
/**
|
31
|
-
|
32
|
-
|
34
|
+
* @deprecated use `isTestCase` instead
|
35
|
+
*/
|
33
36
|
declare function isAtomTest(s: Task): s is Test;
|
34
37
|
declare function isTestCase(s: Task): s is Test;
|
35
38
|
declare function getTests(suite: Arrayable<Task>): Test[];
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/runner",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.0.
|
4
|
+
"version": "3.0.9",
|
5
5
|
"description": "Vitest test runner",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -39,7 +39,7 @@
|
|
39
39
|
],
|
40
40
|
"dependencies": {
|
41
41
|
"pathe": "^2.0.3",
|
42
|
-
"@vitest/utils": "3.0.
|
42
|
+
"@vitest/utils": "3.0.9"
|
43
43
|
},
|
44
44
|
"scripts": {
|
45
45
|
"build": "rimraf dist && rollup -c",
|