Socket
Socket
Sign inDemoInstall

@vitest/runner

Package Overview
Dependencies
Maintainers
4
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitest/runner - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

dist/tasks-B4r0U6Dq.d.ts

4

dist/index.d.ts
import { VitestRunner } from './types.js';
export { CancelReason, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource } from './types.js';
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-_kyNRBhz.js';
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-_kyNRBhz.js';
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-B4r0U6Dq.js';
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-B4r0U6Dq.js';
import { Awaitable } from '@vitest/utils';

@@ -6,0 +6,0 @@ export { processError } from '@vitest/utils/error';

@@ -7,2 +7,3 @@ import limit from 'p-limit';

import { relative } from 'pathe';
import { parseSingleStack } from '@vitest/utils/source-map';

@@ -264,12 +265,17 @@ const fnMap = /* @__PURE__ */ new WeakMap();

let defaultSuite;
let currentTestFilepath;
function getDefaultSuite() {
return defaultSuite;
}
function getTestFilepath() {
return currentTestFilepath;
}
function getRunner() {
return runner;
}
function clearCollectorContext(currentRunner) {
function clearCollectorContext(filepath, currentRunner) {
if (!defaultSuite)
defaultSuite = currentRunner.config.sequence.shuffle ? suite.shuffle("") : currentRunner.config.sequence.concurrent ? suite.concurrent("") : suite("");
runner = currentRunner;
currentTestFilepath = filepath;
collectorContext.tasks.length = 0;

@@ -320,3 +326,3 @@ defaultSuite.clear();

let suite2;
initSuite();
initSuite(true);
const task = function(name2 = "", options = {}) {

@@ -353,2 +359,11 @@ const task2 = {

}
if (runner.config.includeTaskLocation) {
const limit = Error.stackTraceLimit;
Error.stackTraceLimit = 10;
const error = new Error("stacktrace").stack;
Error.stackTraceLimit = limit;
const stack = findStackTrace(error, task2.each ?? false);
if (stack)
task2.location = stack;
}
tasks.push(task2);

@@ -387,3 +402,3 @@ return task2;

}
function initSuite() {
function initSuite(includeLocation) {
if (typeof suiteOptions === "number")

@@ -402,2 +417,17 @@ suiteOptions = { timeout: suiteOptions };

};
if (runner && includeLocation && runner.config.includeTaskLocation) {
const limit = Error.stackTraceLimit;
Error.stackTraceLimit = 5;
const error = new Error("stacktrace").stack;
Error.stackTraceLimit = limit;
const stack = parseSingleStack(error.split("\n")[5]);
if (stack) {
suite2.location = {
line: stack.line,
// because source map is boundary based, this line leads to ")" in test.each()[(]),
// but it should be the next opening bracket - here we assume it's on the same line
column: each ? stack.column + 1 : stack.column
};
}
}
setHooks(suite2, createSuiteHooks());

@@ -408,3 +438,3 @@ }

factoryQueue.length = 0;
initSuite();
initSuite(false);
}

@@ -546,2 +576,20 @@ async function collect(file) {

}
function findStackTrace(error, each) {
const lines = error.split("\n").slice(4);
for (const line of lines) {
const stack = parseSingleStack(line);
if (stack && stack.file === getTestFilepath()) {
return {
line: stack.line,
/**
* test.each([1, 2])('name')
* ^ leads here, but should
* ^ lead here
* in source maps it's the same boundary, so it just points to the start of it
*/
column: each ? stack.column + 1 : stack.column
};
}
}
}

@@ -578,3 +626,3 @@ async function runSetupFiles(config, runner) {

};
clearCollectorContext(runner);
clearCollectorContext(filepath, runner);
try {

@@ -912,3 +960,3 @@ const setupStart = now$1();

const files = await collectTests(paths, runner);
(_b = runner.onCollected) == null ? void 0 : _b.call(runner, files);
await ((_b = runner.onCollected) == null ? void 0 : _b.call(runner, files));
await ((_c = runner.onBeforeRunFiles) == null ? void 0 : _c.call(runner, files));

@@ -915,0 +963,0 @@ await runFiles(files, runner);

@@ -1,3 +0,3 @@

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-_kyNRBhz.js';
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-_kyNRBhz.js';
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-B4r0U6Dq.js';
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-B4r0U6Dq.js';
import { DiffOptions } from '@vitest/utils/diff';

@@ -27,2 +27,3 @@ import '@vitest/utils';

retry: number;
includeTaskLocation?: boolean;
diffOptions?: DiffOptions;

@@ -29,0 +30,0 @@ }

@@ -1,3 +0,3 @@

import { S as Suite, T as Task, a as Test, C as Custom } from './tasks-_kyNRBhz.js';
export { b as ChainableFunction, c as createChainable } from './tasks-_kyNRBhz.js';
import { S as Suite, T as Task, a as Test, C as Custom } from './tasks-B4r0U6Dq.js';
export { b as ChainableFunction, c as createChainable } from './tasks-B4r0U6Dq.js';
import { Arrayable } from '@vitest/utils';

@@ -4,0 +4,0 @@

{
"name": "@vitest/runner",
"type": "module",
"version": "1.3.1",
"version": "1.4.0",
"description": "Vitest test runner",

@@ -43,3 +43,3 @@ "license": "MIT",

"pathe": "^1.1.1",
"@vitest/utils": "1.3.1"
"@vitest/utils": "1.4.0"
},

@@ -46,0 +46,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc