Socket
Socket
Sign inDemoInstall

@vitest/runner

Package Overview
Dependencies
Maintainers
3
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 0.30.1 to 0.31.0

dist/runner-7aa38127.d.ts

112

./dist/index.js

@@ -113,2 +113,8 @@ import limit from 'p-limit';

options = { timeout: options };
if (typeof suiteOptions === "object") {
options = {
...suiteOptions,
...options
};
}
const test3 = {

@@ -121,3 +127,4 @@ id: "",

fails: this.fails,
retry: options == null ? void 0 : options.retry
retry: options == null ? void 0 : options.retry,
repeats: options == null ? void 0 : options.repeats
};

@@ -165,2 +172,4 @@ if (this.concurrent || concurrent)

function initSuite() {
if (typeof suiteOptions === "number")
suiteOptions = { timeout: suiteOptions };
suite2 = {

@@ -439,37 +448,44 @@ id: "",

setCurrentTest(test);
const retry = test.retry || 1;
for (let retryCount = 0; retryCount < retry; retryCount++) {
let beforeEachCleanups = [];
try {
await ((_c = runner.onBeforeTryTest) == null ? void 0 : _c.call(runner, test, retryCount));
beforeEachCleanups = await callSuiteHook(test.suite, test, "beforeEach", runner, [test.context, test.suite]);
test.result.retryCount = retryCount;
if (runner.runTest) {
await runner.runTest(test);
} else {
const fn = getFn(test);
if (!fn)
throw new Error("Test function is not found. Did you add it using `setFn`?");
await fn();
const repeats = typeof test.repeats === "number" ? test.repeats : 1;
for (let repeatCount = 0; repeatCount < repeats; repeatCount++) {
const retry = test.retry || 1;
for (let retryCount = 0; retryCount < retry; retryCount++) {
let beforeEachCleanups = [];
try {
await ((_c = runner.onBeforeTryTest) == null ? void 0 : _c.call(runner, test, { retry: retryCount, repeats: repeatCount }));
test.result.retryCount = retryCount;
test.result.repeatCount = repeatCount;
beforeEachCleanups = await callSuiteHook(test.suite, test, "beforeEach", runner, [test.context, test.suite]);
if (runner.runTest) {
await runner.runTest(test);
} else {
const fn = getFn(test);
if (!fn)
throw new Error("Test function is not found. Did you add it using `setFn`?");
await fn();
}
if (test.promises) {
const result = await Promise.allSettled(test.promises);
const errors = result.map((r) => r.status === "rejected" ? r.reason : void 0).filter(Boolean);
if (errors.length)
throw errors;
}
await ((_d = runner.onAfterTryTest) == null ? void 0 : _d.call(runner, test, { retry: retryCount, repeats: repeatCount }));
if (!test.repeats)
test.result.state = "pass";
else if (test.repeats && retry === retryCount)
test.result.state = "pass";
} catch (e) {
failTask(test.result, e);
}
if (test.promises) {
const result = await Promise.allSettled(test.promises);
const errors = result.map((r) => r.status === "rejected" ? r.reason : void 0).filter(Boolean);
if (errors.length)
throw errors;
try {
await callSuiteHook(test.suite, test, "afterEach", runner, [test.context, test.suite]);
await callCleanupHooks(beforeEachCleanups);
} catch (e) {
failTask(test.result, e);
}
await ((_d = runner.onAfterTryTest) == null ? void 0 : _d.call(runner, test, retryCount));
test.result.state = "pass";
} catch (e) {
failTask(test.result, e);
if (test.result.state === "pass")
break;
updateTask(test, runner);
}
try {
await callSuiteHook(test.suite, test, "afterEach", runner, [test.context, test.suite]);
await callCleanupHooks(beforeEachCleanups);
} catch (e) {
failTask(test.result, e);
}
if (test.result.state === "pass")
break;
updateTask(test, runner);
}

@@ -565,20 +581,20 @@ if (test.result.state === "fail")

}
}
suite.result.duration = now() - start;
if (suite.mode === "run") {
if (!hasTests(suite)) {
suite.result.state = "fail";
if (!suite.result.error) {
const error = processError(new Error(`No test found in suite ${suite.name}`));
suite.result.error = error;
suite.result.errors = [error];
if (suite.mode === "run") {
if (!hasTests(suite)) {
suite.result.state = "fail";
if (!suite.result.error) {
const error = processError(new Error(`No test found in suite ${suite.name}`));
suite.result.error = error;
suite.result.errors = [error];
}
} else if (hasFailed(suite)) {
suite.result.state = "fail";
} else {
suite.result.state = "pass";
}
} else if (hasFailed(suite)) {
suite.result.state = "fail";
} else {
suite.result.state = "pass";
}
updateTask(suite, runner);
suite.result.duration = now() - start;
await ((_c = runner.onAfterRunSuite) == null ? void 0 : _c.call(runner, suite));
}
await ((_c = runner.onAfterRunSuite) == null ? void 0 : _c.call(runner, suite));
updateTask(suite, runner);
}

@@ -585,0 +601,0 @@ async function runSuiteChild(c, runner) {

@@ -1,5 +0,5 @@

import { V as VitestRunner } from './runner-3b8473ea.js';
export { a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-3b8473ea.js';
import { T as Task, F as File, S as SuiteAPI, a as TestAPI, b as SuiteCollector, c as SuiteHooks, O as OnTestFailedHandler, d as Test } from './tasks-c965d7f6.js';
export { D as DoneCallback, m as HookCleanupCallback, H as HookListener, R as RunMode, o as RuntimeContext, q as SequenceHooks, r as SequenceSetupFiles, j as Suite, n as SuiteFactory, f as TaskBase, g as TaskCustom, h as TaskResult, i as TaskResultPack, e as TaskState, p as TestContext, k as TestFunction, l as TestOptions } from './tasks-c965d7f6.js';
import { V as VitestRunner } from './runner-7aa38127.js';
export { C as CancelReason, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-7aa38127.js';
import { T as Task, F as File, S as SuiteAPI, a as TestAPI, b as SuiteCollector, c as SuiteHooks, O as OnTestFailedHandler, d as Test } from './tasks-2a410173.js';
export { D as DoneCallback, m as HookCleanupCallback, H as HookListener, R as RunMode, o as RuntimeContext, q as SequenceHooks, r as SequenceSetupFiles, j as Suite, n as SuiteFactory, f as TaskBase, g as TaskCustom, h as TaskResult, i as TaskResultPack, e as TaskState, p as TestContext, k as TestFunction, l as TestOptions } from './tasks-2a410173.js';
import { Awaitable } from '@vitest/utils';

@@ -6,0 +6,0 @@

@@ -113,2 +113,8 @@ import limit from 'p-limit';

options = { timeout: options };
if (typeof suiteOptions === "object") {
options = {
...suiteOptions,
...options
};
}
const test3 = {

@@ -121,3 +127,4 @@ id: "",

fails: this.fails,
retry: options == null ? void 0 : options.retry
retry: options == null ? void 0 : options.retry,
repeats: options == null ? void 0 : options.repeats
};

@@ -165,2 +172,4 @@ if (this.concurrent || concurrent)

function initSuite() {
if (typeof suiteOptions === "number")
suiteOptions = { timeout: suiteOptions };
suite2 = {

@@ -439,37 +448,44 @@ id: "",

setCurrentTest(test);
const retry = test.retry || 1;
for (let retryCount = 0; retryCount < retry; retryCount++) {
let beforeEachCleanups = [];
try {
await ((_c = runner.onBeforeTryTest) == null ? void 0 : _c.call(runner, test, retryCount));
beforeEachCleanups = await callSuiteHook(test.suite, test, "beforeEach", runner, [test.context, test.suite]);
test.result.retryCount = retryCount;
if (runner.runTest) {
await runner.runTest(test);
} else {
const fn = getFn(test);
if (!fn)
throw new Error("Test function is not found. Did you add it using `setFn`?");
await fn();
const repeats = typeof test.repeats === "number" ? test.repeats : 1;
for (let repeatCount = 0; repeatCount < repeats; repeatCount++) {
const retry = test.retry || 1;
for (let retryCount = 0; retryCount < retry; retryCount++) {
let beforeEachCleanups = [];
try {
await ((_c = runner.onBeforeTryTest) == null ? void 0 : _c.call(runner, test, { retry: retryCount, repeats: repeatCount }));
test.result.retryCount = retryCount;
test.result.repeatCount = repeatCount;
beforeEachCleanups = await callSuiteHook(test.suite, test, "beforeEach", runner, [test.context, test.suite]);
if (runner.runTest) {
await runner.runTest(test);
} else {
const fn = getFn(test);
if (!fn)
throw new Error("Test function is not found. Did you add it using `setFn`?");
await fn();
}
if (test.promises) {
const result = await Promise.allSettled(test.promises);
const errors = result.map((r) => r.status === "rejected" ? r.reason : void 0).filter(Boolean);
if (errors.length)
throw errors;
}
await ((_d = runner.onAfterTryTest) == null ? void 0 : _d.call(runner, test, { retry: retryCount, repeats: repeatCount }));
if (!test.repeats)
test.result.state = "pass";
else if (test.repeats && retry === retryCount)
test.result.state = "pass";
} catch (e) {
failTask(test.result, e);
}
if (test.promises) {
const result = await Promise.allSettled(test.promises);
const errors = result.map((r) => r.status === "rejected" ? r.reason : void 0).filter(Boolean);
if (errors.length)
throw errors;
try {
await callSuiteHook(test.suite, test, "afterEach", runner, [test.context, test.suite]);
await callCleanupHooks(beforeEachCleanups);
} catch (e) {
failTask(test.result, e);
}
await ((_d = runner.onAfterTryTest) == null ? void 0 : _d.call(runner, test, retryCount));
test.result.state = "pass";
} catch (e) {
failTask(test.result, e);
if (test.result.state === "pass")
break;
updateTask(test, runner);
}
try {
await callSuiteHook(test.suite, test, "afterEach", runner, [test.context, test.suite]);
await callCleanupHooks(beforeEachCleanups);
} catch (e) {
failTask(test.result, e);
}
if (test.result.state === "pass")
break;
updateTask(test, runner);
}

@@ -565,20 +581,20 @@ if (test.result.state === "fail")

}
}
suite.result.duration = now() - start;
if (suite.mode === "run") {
if (!hasTests(suite)) {
suite.result.state = "fail";
if (!suite.result.error) {
const error = processError(new Error(`No test found in suite ${suite.name}`));
suite.result.error = error;
suite.result.errors = [error];
if (suite.mode === "run") {
if (!hasTests(suite)) {
suite.result.state = "fail";
if (!suite.result.error) {
const error = processError(new Error(`No test found in suite ${suite.name}`));
suite.result.error = error;
suite.result.errors = [error];
}
} else if (hasFailed(suite)) {
suite.result.state = "fail";
} else {
suite.result.state = "pass";
}
} else if (hasFailed(suite)) {
suite.result.state = "fail";
} else {
suite.result.state = "pass";
}
updateTask(suite, runner);
suite.result.duration = now() - start;
await ((_c = runner.onAfterRunSuite) == null ? void 0 : _c.call(runner, suite));
}
await ((_c = runner.onAfterRunSuite) == null ? void 0 : _c.call(runner, suite));
updateTask(suite, runner);
}

@@ -585,0 +601,0 @@ async function runSuiteChild(c, runner) {

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

export { D as DoneCallback, F as File, m as HookCleanupCallback, H as HookListener, O as OnTestFailedHandler, R as RunMode, o as RuntimeContext, q as SequenceHooks, r as SequenceSetupFiles, j as Suite, S as SuiteAPI, b as SuiteCollector, n as SuiteFactory, c as SuiteHooks, T as Task, f as TaskBase, g as TaskCustom, h as TaskResult, i as TaskResultPack, e as TaskState, d as Test, a as TestAPI, p as TestContext, k as TestFunction, l as TestOptions } from './tasks-c965d7f6.js';
export { V as VitestRunner, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-3b8473ea.js';
export { D as DoneCallback, F as File, m as HookCleanupCallback, H as HookListener, O as OnTestFailedHandler, R as RunMode, o as RuntimeContext, q as SequenceHooks, r as SequenceSetupFiles, j as Suite, S as SuiteAPI, b as SuiteCollector, n as SuiteFactory, c as SuiteHooks, T as Task, f as TaskBase, g as TaskCustom, h as TaskResult, i as TaskResultPack, e as TaskState, d as Test, a as TestAPI, p as TestContext, k as TestFunction, l as TestOptions } from './tasks-2a410173.js';
export { C as CancelReason, V as VitestRunner, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-7aa38127.js';
import '@vitest/utils';

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

import { j as Suite, T as Task, d as Test, g as TaskCustom } from './tasks-c965d7f6.js';
export { C as ChainableFunction, s as createChainable } from './tasks-c965d7f6.js';
import { j as Suite, T as Task, d as Test, g as TaskCustom } from './tasks-2a410173.js';
export { C as ChainableFunction, s as createChainable } from './tasks-2a410173.js';
import { Arrayable } from '@vitest/utils';

@@ -4,0 +4,0 @@ export { ErrorWithDiff, ParsedStack } from '@vitest/utils';

{
"name": "@vitest/runner",
"type": "module",
"version": "0.30.1",
"version": "0.31.0",
"description": "Vitest test runner",
"license": "MIT",
"funding": "https://opencollective.com/vitest",
"homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/runner#readme",
"repository": {

@@ -12,2 +14,5 @@ "type": "git",

},
"bugs": {
"url": "https://github.com/vitest-dev/vitest/issues"
},
"sideEffects": true,

@@ -40,3 +45,3 @@ "exports": {

"pathe": "^1.1.0",
"@vitest/utils": "0.30.1"
"@vitest/utils": "0.31.0"
},

@@ -43,0 +48,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