@vitest/runner 1.4.0 → 1.5.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.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -14
- package/dist/{tasks-B4r0U6Dq.d.ts → tasks-K5XERDtv.d.ts} +4 -4
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
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, i as OnTestFinishedHandler, a as Test, C as Custom, S as Suite } from './tasks-
|
4
|
-
export { D as DoneCallback, E as ExtendedContext, t as Fixture, s as FixtureFn, r as FixtureOptions, u as Fixtures, v as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, R as RunMode, y as RuntimeContext, B as SequenceHooks, G as SequenceSetupFiles, x as SuiteFactory, k as TaskBase, A as TaskContext, w as TaskCustomOptions, m as TaskMeta, l as TaskPopulated, n as TaskResult, o as TaskResultPack, j as TaskState, z as TestContext, p as TestFunction, q as TestOptions, U as Use } 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, i as OnTestFinishedHandler, a as Test, C as Custom, S as Suite } from './tasks-K5XERDtv.js';
|
4
|
+
export { D as DoneCallback, E as ExtendedContext, t as Fixture, s as FixtureFn, r as FixtureOptions, u as Fixtures, v as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, R as RunMode, y as RuntimeContext, B as SequenceHooks, G as SequenceSetupFiles, x as SuiteFactory, k as TaskBase, A as TaskContext, w as TaskCustomOptions, m as TaskMeta, l as TaskPopulated, n as TaskResult, o as TaskResultPack, j as TaskState, z as TestContext, p as TestFunction, q as TestOptions, U as Use } from './tasks-K5XERDtv.js';
|
5
5
|
import { Awaitable } from '@vitest/utils';
|
6
6
|
export { processError } from '@vitest/utils/error';
|
7
7
|
import '@vitest/utils/diff';
|
package/dist/index.js
CHANGED
@@ -355,10 +355,10 @@ function createSuiteCollector(name, factory = () => {
|
|
355
355
|
}
|
356
356
|
if (runner.config.includeTaskLocation) {
|
357
357
|
const limit = Error.stackTraceLimit;
|
358
|
-
Error.stackTraceLimit =
|
358
|
+
Error.stackTraceLimit = 15;
|
359
359
|
const error = new Error("stacktrace").stack;
|
360
360
|
Error.stackTraceLimit = limit;
|
361
|
-
const stack =
|
361
|
+
const stack = findTestFileStackTrace(error, task2.each ?? false);
|
362
362
|
if (stack)
|
363
363
|
task2.location = stack;
|
364
364
|
}
|
@@ -411,18 +411,12 @@ function createSuiteCollector(name, factory = () => {
|
|
411
411
|
};
|
412
412
|
if (runner && includeLocation && runner.config.includeTaskLocation) {
|
413
413
|
const limit = Error.stackTraceLimit;
|
414
|
-
Error.stackTraceLimit =
|
414
|
+
Error.stackTraceLimit = 15;
|
415
415
|
const error = new Error("stacktrace").stack;
|
416
416
|
Error.stackTraceLimit = limit;
|
417
|
-
const stack =
|
418
|
-
if (stack)
|
419
|
-
suite2.location =
|
420
|
-
line: stack.line,
|
421
|
-
// because source map is boundary based, this line leads to ")" in test.each()[(]),
|
422
|
-
// but it should be the next opening bracket - here we assume it's on the same line
|
423
|
-
column: each ? stack.column + 1 : stack.column
|
424
|
-
};
|
425
|
-
}
|
417
|
+
const stack = findTestFileStackTrace(error, suite2.each ?? false);
|
418
|
+
if (stack)
|
419
|
+
suite2.location = stack;
|
426
420
|
}
|
427
421
|
setHooks(suite2, createSuiteHooks());
|
428
422
|
}
|
@@ -566,8 +560,8 @@ function formatTemplateString(cases, args) {
|
|
566
560
|
}
|
567
561
|
return res;
|
568
562
|
}
|
569
|
-
function
|
570
|
-
const lines = error.split("\n").slice(
|
563
|
+
function findTestFileStackTrace(error, each) {
|
564
|
+
const lines = error.split("\n").slice(1);
|
571
565
|
for (const line of lines) {
|
572
566
|
const stack = parseSingleStack(line);
|
573
567
|
if (stack && stack.file === getTestFilepath()) {
|
@@ -203,9 +203,9 @@ interface SuiteCollectorCallable<ExtraContext = {}> {
|
|
203
203
|
/**
|
204
204
|
* @deprecated Use options as the second argument instead
|
205
205
|
*/
|
206
|
-
(name: string | Function, fn: SuiteFactory<
|
207
|
-
(name: string | Function, fn?: SuiteFactory<
|
208
|
-
(name: string | Function, options: TestOptions, fn?: SuiteFactory<
|
206
|
+
<OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, fn: SuiteFactory<OverrideExtraContext>, options: TestOptions): SuiteCollector<OverrideExtraContext>;
|
207
|
+
<OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, fn?: SuiteFactory<OverrideExtraContext>, options?: number | TestOptions): SuiteCollector<OverrideExtraContext>;
|
208
|
+
<OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, options: TestOptions, fn?: SuiteFactory<OverrideExtraContext>): SuiteCollector<OverrideExtraContext>;
|
209
209
|
}
|
210
210
|
type ChainableSuiteAPI<ExtraContext = {}> = ChainableFunction<'concurrent' | 'sequential' | 'only' | 'skip' | 'todo' | 'shuffle', SuiteCollectorCallable<ExtraContext>, {
|
211
211
|
each: TestEachFunction;
|
@@ -246,7 +246,7 @@ interface SuiteCollector<ExtraContext = {}> {
|
|
246
246
|
clear: () => void;
|
247
247
|
on: <T extends keyof SuiteHooks<ExtraContext>>(name: T, ...fn: SuiteHooks<ExtraContext>[T]) => void;
|
248
248
|
}
|
249
|
-
type SuiteFactory<ExtraContext = {}> = (test:
|
249
|
+
type SuiteFactory<ExtraContext = {}> = (test: TestAPI<ExtraContext>) => Awaitable<void>;
|
250
250
|
interface RuntimeContext {
|
251
251
|
tasks: (SuiteCollector | Test)[];
|
252
252
|
currentSuite: SuiteCollector | null;
|
package/dist/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { B as SequenceHooks, G as SequenceSetupFiles, F as File, T as Task, S as Suite, o as TaskResultPack, a as Test, C as Custom, A as TaskContext, E as ExtendedContext } from './tasks-
|
2
|
-
export { g as CustomAPI, D as DoneCallback, t as Fixture, s as FixtureFn, r as FixtureOptions, u as Fixtures, v as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, i as OnTestFinishedHandler, R as RunMode, y as RuntimeContext, d as SuiteAPI, f as SuiteCollector, x as SuiteFactory, h as SuiteHooks, k as TaskBase, w as TaskCustomOptions, m as TaskMeta, l as TaskPopulated, n as TaskResult, j as TaskState, e as TestAPI, z as TestContext, p as TestFunction, q as TestOptions, U as Use } from './tasks-
|
1
|
+
import { B as SequenceHooks, G as SequenceSetupFiles, F as File, T as Task, S as Suite, o as TaskResultPack, a as Test, C as Custom, A as TaskContext, E as ExtendedContext } from './tasks-K5XERDtv.js';
|
2
|
+
export { g as CustomAPI, D as DoneCallback, t as Fixture, s as FixtureFn, r as FixtureOptions, u as Fixtures, v as HookCleanupCallback, H as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, i as OnTestFinishedHandler, R as RunMode, y as RuntimeContext, d as SuiteAPI, f as SuiteCollector, x as SuiteFactory, h as SuiteHooks, k as TaskBase, w as TaskCustomOptions, m as TaskMeta, l as TaskPopulated, n as TaskResult, j as TaskState, e as TestAPI, z as TestContext, p as TestFunction, q as TestOptions, U as Use } from './tasks-K5XERDtv.js';
|
3
3
|
import { DiffOptions } from '@vitest/utils/diff';
|
4
4
|
import '@vitest/utils';
|
5
5
|
|
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-K5XERDtv.js';
|
2
|
+
export { b as ChainableFunction, c as createChainable } from './tasks-K5XERDtv.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.
|
4
|
+
"version": "1.5.0",
|
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": "^5.0.0",
|
42
42
|
"pathe": "^1.1.1",
|
43
|
-
"@vitest/utils": "1.
|
43
|
+
"@vitest/utils": "1.5.0"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"build": "rimraf dist && rollup -c",
|