Socket
Socket
Sign inDemoInstall

@vitest/runner

Package Overview
Dependencies
Maintainers
3
Versions
92
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.29.7 to 0.29.8

194

dist/chunk-tasks.js

@@ -19,99 +19,2 @@ import { format, deepClone, stringify, getOwnProperties, getType, toArray } from '@vitest/utils';

function interpretTaskModes(suite, namePattern, onlyMode, parentIsOnly, allowOnly) {
const suiteIsOnly = parentIsOnly || suite.mode === "only";
suite.tasks.forEach((t) => {
const includeTask = suiteIsOnly || t.mode === "only";
if (onlyMode) {
if (t.type === "suite" && (includeTask || someTasksAreOnly(t))) {
if (t.mode === "only") {
checkAllowOnly(t, allowOnly);
t.mode = "run";
}
} else if (t.mode === "run" && !includeTask) {
t.mode = "skip";
} else if (t.mode === "only") {
checkAllowOnly(t, allowOnly);
t.mode = "run";
}
}
if (t.type === "test") {
if (namePattern && !getTaskFullName(t).match(namePattern))
t.mode = "skip";
} else if (t.type === "suite") {
if (t.mode === "skip")
skipAllTasks(t);
else
interpretTaskModes(t, namePattern, onlyMode, includeTask, allowOnly);
}
});
if (suite.mode === "run") {
if (suite.tasks.length && suite.tasks.every((i) => i.mode !== "run"))
suite.mode = "skip";
}
}
function getTaskFullName(task) {
return `${task.suite ? `${getTaskFullName(task.suite)} ` : ""}${task.name}`;
}
function someTasksAreOnly(suite) {
return suite.tasks.some((t) => t.mode === "only" || t.type === "suite" && someTasksAreOnly(t));
}
function skipAllTasks(suite) {
suite.tasks.forEach((t) => {
if (t.mode === "run") {
t.mode = "skip";
if (t.type === "suite")
skipAllTasks(t);
}
});
}
function checkAllowOnly(task, allowOnly) {
if (allowOnly)
return;
const error = new Error("[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error");
task.result = {
state: "fail",
error,
errors: [error]
};
}
function generateHash(str) {
let hash = 0;
if (str.length === 0)
return `${hash}`;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash;
}
return `${hash}`;
}
function calculateSuiteHash(parent) {
parent.tasks.forEach((t, idx) => {
t.id = `${parent.id}_${idx}`;
if (t.type === "suite")
calculateSuiteHash(t);
});
}
function createChainable(keys, fn) {
function create(context) {
const chain2 = function(...args) {
return fn.apply(context, args);
};
Object.assign(chain2, fn);
chain2.withContext = () => chain2.bind(context);
for (const key of keys) {
Object.defineProperty(chain2, key, {
get() {
return create({ ...context, [key]: true });
}
});
}
return chain2;
}
const chain = create({});
chain.fn = fn;
return chain;
}
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";

@@ -254,2 +157,99 @@ const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";

function interpretTaskModes(suite, namePattern, onlyMode, parentIsOnly, allowOnly) {
const suiteIsOnly = parentIsOnly || suite.mode === "only";
suite.tasks.forEach((t) => {
const includeTask = suiteIsOnly || t.mode === "only";
if (onlyMode) {
if (t.type === "suite" && (includeTask || someTasksAreOnly(t))) {
if (t.mode === "only") {
checkAllowOnly(t, allowOnly);
t.mode = "run";
}
} else if (t.mode === "run" && !includeTask) {
t.mode = "skip";
} else if (t.mode === "only") {
checkAllowOnly(t, allowOnly);
t.mode = "run";
}
}
if (t.type === "test") {
if (namePattern && !getTaskFullName(t).match(namePattern))
t.mode = "skip";
} else if (t.type === "suite") {
if (t.mode === "skip")
skipAllTasks(t);
else
interpretTaskModes(t, namePattern, onlyMode, includeTask, allowOnly);
}
});
if (suite.mode === "run") {
if (suite.tasks.length && suite.tasks.every((i) => i.mode !== "run"))
suite.mode = "skip";
}
}
function getTaskFullName(task) {
return `${task.suite ? `${getTaskFullName(task.suite)} ` : ""}${task.name}`;
}
function someTasksAreOnly(suite) {
return suite.tasks.some((t) => t.mode === "only" || t.type === "suite" && someTasksAreOnly(t));
}
function skipAllTasks(suite) {
suite.tasks.forEach((t) => {
if (t.mode === "run") {
t.mode = "skip";
if (t.type === "suite")
skipAllTasks(t);
}
});
}
function checkAllowOnly(task, allowOnly) {
if (allowOnly)
return;
const error = processError(new Error("[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error"));
task.result = {
state: "fail",
error,
errors: [error]
};
}
function generateHash(str) {
let hash = 0;
if (str.length === 0)
return `${hash}`;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash;
}
return `${hash}`;
}
function calculateSuiteHash(parent) {
parent.tasks.forEach((t, idx) => {
t.id = `${parent.id}_${idx}`;
if (t.type === "suite")
calculateSuiteHash(t);
});
}
function createChainable(keys, fn) {
function create(context) {
const chain2 = function(...args) {
return fn.apply(context, args);
};
Object.assign(chain2, fn);
chain2.withContext = () => chain2.bind(context);
for (const key of keys) {
Object.defineProperty(chain2, key, {
get() {
return create({ ...context, [key]: true });
}
});
}
return chain2;
}
const chain = create({});
chain.fn = fn;
return chain;
}
function isAtomTest(s) {

@@ -256,0 +256,0 @@ return s.type === "test" || s.type === "custom";

{
"name": "@vitest/runner",
"type": "module",
"version": "0.29.7",
"version": "0.29.8",
"description": "Vitest test runner",

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

"pathe": "^1.1.0",
"@vitest/utils": "0.29.7"
"@vitest/utils": "0.29.8"
},

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