@vitest/runner 1.0.0-beta.0 → 1.0.0-beta.2
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 +3 -2
- package/dist/index.js +5 -12
- package/dist/{tasks-b31a73cb.d.ts → tasks-54dc134a.d.ts} +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import { VitestRunner } from './types.js';
|
2
2
|
export { CancelReason, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource } from './types.js';
|
3
|
-
import { T as Task, F as File, d as SuiteAPI, e as TestAPI, f as SuiteCollector, g as CustomAPI, h as SuiteHooks, O as OnTestFailedHandler, a as Test, C as Custom } from './tasks-
|
4
|
-
export { D as DoneCallback, E as ExtendedContext, q as Fixture, r as Fixtures, s as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, R as RunMode, v as RuntimeContext, y as SequenceHooks, z as SequenceSetupFiles, S as Suite, u as SuiteFactory, j as TaskBase, x as TaskContext, t as TaskCustomOptions, l as TaskMeta, k as TaskPopulated, m as TaskResult, n as TaskResultPack, i as TaskState, w as TestContext, o as TestFunction, p as TestOptions } from './tasks-
|
3
|
+
import { T as Task, F as File, d as SuiteAPI, e as TestAPI, f as SuiteCollector, g as CustomAPI, h as SuiteHooks, O as OnTestFailedHandler, a as Test, C as Custom } from './tasks-54dc134a.js';
|
4
|
+
export { D as DoneCallback, E as ExtendedContext, q as Fixture, r as Fixtures, s as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, R as RunMode, v as RuntimeContext, y as SequenceHooks, z as SequenceSetupFiles, S as Suite, u as SuiteFactory, j as TaskBase, x as TaskContext, t as TaskCustomOptions, l as TaskMeta, k as TaskPopulated, m as TaskResult, n as TaskResultPack, i as TaskState, w as TestContext, o as TestFunction, p as TestOptions } from './tasks-54dc134a.js';
|
5
5
|
import { Awaitable } from '@vitest/utils';
|
6
|
+
export { processError } from '@vitest/utils/error';
|
6
7
|
|
7
8
|
declare function updateTask(task: Task, runner: VitestRunner): void;
|
8
9
|
declare function startTests(paths: string[], runner: VitestRunner): Promise<File[]>;
|
package/dist/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import limit from 'p-limit';
|
2
2
|
import { getSafeTimers, format, isObject, objDisplay, objectAttr, noop, toArray, shuffle } from '@vitest/utils';
|
3
3
|
import { processError } from '@vitest/utils/error';
|
4
|
+
export { processError } from '@vitest/utils/error';
|
4
5
|
import { createChainable, generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, partitionSuiteChildren, hasTests, hasFailed } from './utils.js';
|
5
6
|
import { relative } from 'pathe';
|
6
7
|
|
@@ -110,25 +111,17 @@ function mergeContextFixtures(fixtures, context = {}) {
|
|
110
111
|
return context;
|
111
112
|
}
|
112
113
|
const fixtureValueMap = /* @__PURE__ */ new Map();
|
113
|
-
|
114
|
-
async function callFixtureCleanup(
|
115
|
-
const cleanupFnArray = fixtureCleanupFnMap.get(id);
|
116
|
-
if (!cleanupFnArray)
|
117
|
-
return;
|
114
|
+
let cleanupFnArray = new Array();
|
115
|
+
async function callFixtureCleanup() {
|
118
116
|
for (const cleanup of cleanupFnArray.reverse())
|
119
117
|
await cleanup();
|
120
|
-
|
118
|
+
cleanupFnArray = [];
|
121
119
|
}
|
122
120
|
function withFixtures(fn, testContext) {
|
123
121
|
return (hookContext) => {
|
124
122
|
const context = hookContext || testContext;
|
125
123
|
if (!context)
|
126
124
|
return fn({});
|
127
|
-
let cleanupFnArray = fixtureCleanupFnMap.get(context.task.suite.id);
|
128
|
-
if (!cleanupFnArray) {
|
129
|
-
cleanupFnArray = [];
|
130
|
-
fixtureCleanupFnMap.set(context.task.suite.id, cleanupFnArray);
|
131
|
-
}
|
132
125
|
const fixtures = getFixture(context);
|
133
126
|
if (!(fixtures == null ? void 0 : fixtures.length))
|
134
127
|
return fn(context);
|
@@ -688,6 +681,7 @@ async function runTest(test, runner) {
|
|
688
681
|
try {
|
689
682
|
await callSuiteHook(test.suite, test, "afterEach", runner, [test.context, test.suite]);
|
690
683
|
await callCleanupHooks(beforeEachCleanups);
|
684
|
+
await callFixtureCleanup();
|
691
685
|
} catch (e) {
|
692
686
|
failTask(test.result, e, runner.config.diffOptions);
|
693
687
|
}
|
@@ -788,7 +782,6 @@ async function runSuite(suite, runner) {
|
|
788
782
|
failTask(suite.result, e, runner.config.diffOptions);
|
789
783
|
}
|
790
784
|
try {
|
791
|
-
await callFixtureCleanup(suite.id);
|
792
785
|
await callSuiteHook(suite, suite, "afterAll", runner, [suite]);
|
793
786
|
await callCleanupHooks(beforeAllCleanups);
|
794
787
|
} catch (e) {
|
@@ -238,4 +238,4 @@ type OnTestFailedHandler = (result: TaskResult) => Awaitable<void>;
|
|
238
238
|
type SequenceHooks = 'stack' | 'list' | 'parallel';
|
239
239
|
type SequenceSetupFiles = 'list' | 'parallel';
|
240
240
|
|
241
|
-
export { Custom as C, DoneCallback as D, ExtendedContext as E, File as F, HookListener as H, InferFixturesTypes as I, OnTestFailedHandler as O, RunMode as R, Suite as S, Task as T, Test as a, ChainableFunction as b, createChainable as c, SuiteAPI as d, TestAPI as e, SuiteCollector as f, CustomAPI as g, SuiteHooks as h, TaskState as i, TaskBase as j, TaskPopulated as k, TaskMeta as l, TaskResult as m, TaskResultPack as n, TestFunction as o, TestOptions as p, Fixture as q, Fixtures as r, HookCleanupCallback as s, TaskCustomOptions as t, SuiteFactory as u, RuntimeContext as v, TestContext as w, TaskContext as x, SequenceHooks as y, SequenceSetupFiles as z };
|
241
|
+
export { type Custom as C, type DoneCallback as D, type ExtendedContext as E, type File as F, type HookListener as H, type InferFixturesTypes as I, type OnTestFailedHandler as O, type RunMode as R, type Suite as S, type Task as T, type Test as a, type ChainableFunction as b, createChainable as c, type SuiteAPI as d, type TestAPI as e, type SuiteCollector as f, type CustomAPI as g, type SuiteHooks as h, type TaskState as i, type TaskBase as j, type TaskPopulated as k, type TaskMeta as l, type TaskResult as m, type TaskResultPack as n, type TestFunction as o, type TestOptions as p, type Fixture as q, type Fixtures as r, type HookCleanupCallback as s, type TaskCustomOptions as t, type SuiteFactory as u, type RuntimeContext as v, type TestContext as w, type TaskContext as x, type SequenceHooks as y, type SequenceSetupFiles as z };
|
package/dist/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { y as SequenceHooks, z as SequenceSetupFiles, F as File, k as TaskPopulated, S as Suite, n as TaskResultPack, a as Test, C as Custom, x as TaskContext, E as ExtendedContext } from './tasks-
|
2
|
-
export { g as CustomAPI, D as DoneCallback, q as Fixture, r as Fixtures, s as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, R as RunMode, v as RuntimeContext, d as SuiteAPI, f as SuiteCollector, u as SuiteFactory, h as SuiteHooks, T as Task, j as TaskBase, t as TaskCustomOptions, l as TaskMeta, m as TaskResult, i as TaskState, e as TestAPI, w as TestContext, o as TestFunction, p as TestOptions } from './tasks-
|
1
|
+
import { y as SequenceHooks, z as SequenceSetupFiles, F as File, k as TaskPopulated, S as Suite, n as TaskResultPack, a as Test, C as Custom, x as TaskContext, E as ExtendedContext } from './tasks-54dc134a.js';
|
2
|
+
export { g as CustomAPI, D as DoneCallback, q as Fixture, r as Fixtures, s as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, R as RunMode, v as RuntimeContext, d as SuiteAPI, f as SuiteCollector, u as SuiteFactory, h as SuiteHooks, T as Task, j as TaskBase, t as TaskCustomOptions, l as TaskMeta, m as TaskResult, i as TaskState, e as TestAPI, w as TestContext, o as TestFunction, p as TestOptions } from './tasks-54dc134a.js';
|
3
3
|
import '@vitest/utils';
|
4
4
|
|
5
5
|
/**
|
@@ -158,4 +158,4 @@ interface VitestRunner {
|
|
158
158
|
config: VitestRunnerConfig;
|
159
159
|
}
|
160
160
|
|
161
|
-
export { CancelReason, Custom, ExtendedContext, File, SequenceHooks, SequenceSetupFiles, Suite, TaskContext, TaskPopulated, TaskResultPack, Test, VitestRunner, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource };
|
161
|
+
export { type CancelReason, Custom, ExtendedContext, File, SequenceHooks, SequenceSetupFiles, Suite, TaskContext, TaskPopulated, TaskResultPack, Test, type VitestRunner, type VitestRunnerConfig, type VitestRunnerConstructor, type VitestRunnerImportSource };
|
package/dist/utils.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { S as Suite, T as Task, a as Test, C as Custom } from './tasks-
|
2
|
-
export { b as ChainableFunction, c as createChainable } from './tasks-
|
1
|
+
import { S as Suite, T as Task, a as Test, C as Custom } from './tasks-54dc134a.js';
|
2
|
+
export { b as ChainableFunction, c as createChainable } from './tasks-54dc134a.js';
|
3
3
|
import { Arrayable } from '@vitest/utils';
|
4
4
|
|
5
5
|
/**
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/runner",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.0.0-beta.
|
4
|
+
"version": "1.0.0-beta.2",
|
5
5
|
"description": "Vitest test runner",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"dependencies": {
|
41
41
|
"p-limit": "^4.0.0",
|
42
42
|
"pathe": "^1.1.1",
|
43
|
-
"@vitest/utils": "1.0.0-beta.
|
43
|
+
"@vitest/utils": "1.0.0-beta.2"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"build": "rimraf dist && rollup -c",
|