@depup/vitest__runner 4.1.0-depup.0

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.
@@ -0,0 +1,179 @@
1
+ import { T as TestArtifact, a as Test, S as Suite, b as SuiteHooks, F as FileSpecification, V as VitestRunner, c as File, d as TaskUpdateEvent, e as Task, f as TestAPI, g as SuiteAPI, h as SuiteCollector } from './tasks.d-D2GKpdwQ.js';
2
+ export { A as AfterAllListener, i as AfterEachListener, j as AroundAllListener, k as AroundEachListener, B as BeforeAllListener, l as BeforeEachListener, C as CancelReason, m as FailureScreenshotArtifact, n as Fixture, o as FixtureFn, p as FixtureOptions, q as Fixtures, I as ImportDuration, r as InferFixturesTypes, O as OnTestFailedHandler, s as OnTestFinishedHandler, R as Retry, t as RunMode, u as RuntimeContext, v as SequenceHooks, w as SequenceSetupFiles, x as SerializableRetry, y as SuiteFactory, z as SuiteOptions, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, W as TestArtifactBase, X as TestArtifactLocation, Y as TestArtifactRegistry, Z as TestAttachment, _ as TestContext, $ as TestFunction, a0 as TestOptions, a1 as TestTagDefinition, a2 as TestTags, a3 as Use, a4 as VisualRegressionArtifact, a5 as VitestRunnerConfig, a6 as VitestRunnerConstructor, a7 as VitestRunnerImportSource, a8 as afterAll, a9 as afterEach, aa as aroundAll, ab as aroundEach, ac as beforeAll, ad as beforeEach, ae as onTestFailed, af as onTestFinished } from './tasks.d-D2GKpdwQ.js';
3
+ import { Awaitable } from '@vitest/utils';
4
+ import '@vitest/utils/diff';
5
+
6
+ /**
7
+ * @experimental
8
+ * @advanced
9
+ *
10
+ * Records a custom test artifact during test execution.
11
+ *
12
+ * This function allows you to attach structured data, files, or metadata to a test.
13
+ *
14
+ * Vitest automatically injects the source location where the artifact was created and manages any attachments you include.
15
+ *
16
+ * **Note:** artifacts must be recorded before the task is reported. Any artifacts recorded after that will not be included in the task.
17
+ *
18
+ * @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests
19
+ * @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase}
20
+ *
21
+ * @returns A promise that resolves to the recorded artifact with location injected
22
+ *
23
+ * @throws {Error} If the test runner doesn't support artifacts
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * // In a custom assertion
28
+ * async function toHaveValidSchema(this: MatcherState, actual: unknown) {
29
+ * const validation = validateSchema(actual)
30
+ *
31
+ * await recordArtifact(this.task, {
32
+ * type: 'my-plugin:schema-validation',
33
+ * passed: validation.valid,
34
+ * errors: validation.errors,
35
+ * })
36
+ *
37
+ * return { pass: validation.valid, message: () => '...' }
38
+ * }
39
+ * ```
40
+ */
41
+ declare function recordArtifact<Artifact extends TestArtifact>(task: Test, artifact: Artifact): Promise<Artifact>;
42
+
43
+ declare function setFn(key: Test, fn: () => Awaitable<void>): void;
44
+ declare function getFn<Task = Test>(key: Task): () => Awaitable<void>;
45
+ declare function setHooks(key: Suite, hooks: SuiteHooks): void;
46
+ declare function getHooks(key: Suite): SuiteHooks;
47
+
48
+ declare function updateTask(event: TaskUpdateEvent, task: Task, runner: VitestRunner): void;
49
+ declare function startTests(specs: string[] | FileSpecification[], runner: VitestRunner): Promise<File[]>;
50
+ declare function publicCollect(specs: string[] | FileSpecification[], runner: VitestRunner): Promise<File[]>;
51
+
52
+ /**
53
+ * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
54
+ * Suites can contain both tests and other suites, enabling complex test structures.
55
+ *
56
+ * @param {string} name - The name of the suite, used for identification and reporting.
57
+ * @param {Function} fn - A function that defines the tests and suites within this suite.
58
+ * @example
59
+ * ```ts
60
+ * // Define a suite with two tests
61
+ * suite('Math operations', () => {
62
+ * test('should add two numbers', () => {
63
+ * expect(add(1, 2)).toBe(3);
64
+ * });
65
+ *
66
+ * test('should subtract two numbers', () => {
67
+ * expect(subtract(5, 2)).toBe(3);
68
+ * });
69
+ * });
70
+ * ```
71
+ * @example
72
+ * ```ts
73
+ * // Define nested suites
74
+ * suite('String operations', () => {
75
+ * suite('Trimming', () => {
76
+ * test('should trim whitespace from start and end', () => {
77
+ * expect(' hello '.trim()).toBe('hello');
78
+ * });
79
+ * });
80
+ *
81
+ * suite('Concatenation', () => {
82
+ * test('should concatenate two strings', () => {
83
+ * expect('hello' + ' ' + 'world').toBe('hello world');
84
+ * });
85
+ * });
86
+ * });
87
+ * ```
88
+ */
89
+ declare const suite: SuiteAPI;
90
+ /**
91
+ * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
92
+ *
93
+ * @param {string | Function} name - The name of the test or a function that will be used as a test name.
94
+ * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
95
+ * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
96
+ * @throws {Error} If called inside another test function.
97
+ * @example
98
+ * ```ts
99
+ * // Define a simple test
100
+ * test('should add two numbers', () => {
101
+ * expect(add(1, 2)).toBe(3);
102
+ * });
103
+ * ```
104
+ * @example
105
+ * ```ts
106
+ * // Define a test with options
107
+ * test('should subtract two numbers', { retry: 3 }, () => {
108
+ * expect(subtract(5, 2)).toBe(3);
109
+ * });
110
+ * ```
111
+ */
112
+ declare const test: TestAPI;
113
+ /**
114
+ * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
115
+ * Suites can contain both tests and other suites, enabling complex test structures.
116
+ *
117
+ * @param {string} name - The name of the suite, used for identification and reporting.
118
+ * @param {Function} fn - A function that defines the tests and suites within this suite.
119
+ * @example
120
+ * ```ts
121
+ * // Define a suite with two tests
122
+ * describe('Math operations', () => {
123
+ * test('should add two numbers', () => {
124
+ * expect(add(1, 2)).toBe(3);
125
+ * });
126
+ *
127
+ * test('should subtract two numbers', () => {
128
+ * expect(subtract(5, 2)).toBe(3);
129
+ * });
130
+ * });
131
+ * ```
132
+ * @example
133
+ * ```ts
134
+ * // Define nested suites
135
+ * describe('String operations', () => {
136
+ * describe('Trimming', () => {
137
+ * test('should trim whitespace from start and end', () => {
138
+ * expect(' hello '.trim()).toBe('hello');
139
+ * });
140
+ * });
141
+ *
142
+ * describe('Concatenation', () => {
143
+ * test('should concatenate two strings', () => {
144
+ * expect('hello' + ' ' + 'world').toBe('hello world');
145
+ * });
146
+ * });
147
+ * });
148
+ * ```
149
+ */
150
+ declare const describe: SuiteAPI;
151
+ /**
152
+ * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
153
+ *
154
+ * @param {string | Function} name - The name of the test or a function that will be used as a test name.
155
+ * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
156
+ * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
157
+ * @throws {Error} If called inside another test function.
158
+ * @example
159
+ * ```ts
160
+ * // Define a simple test
161
+ * it('adds two numbers', () => {
162
+ * expect(add(1, 2)).toBe(3);
163
+ * });
164
+ * ```
165
+ * @example
166
+ * ```ts
167
+ * // Define a test with options
168
+ * it('subtracts two numbers', { retry: 3 }, () => {
169
+ * expect(subtract(5, 2)).toBe(3);
170
+ * });
171
+ * ```
172
+ */
173
+ declare const it: TestAPI;
174
+ declare function getCurrentSuite<ExtraContext = object>(): SuiteCollector<ExtraContext>;
175
+ declare function createTaskCollector(fn: (...args: any[]) => any): TestAPI;
176
+
177
+ declare function getCurrentTest<T extends Test | undefined>(): T;
178
+
179
+ export { File, FileSpecification, Suite, SuiteAPI, SuiteCollector, SuiteHooks, Task, TaskUpdateEvent, Test, TestAPI, TestArtifact, VitestRunner, publicCollect as collectTests, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, recordArtifact, setFn, setHooks, startTests, suite, test, updateTask };