@vitest/runner
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
import { processError } from '@vitest/utils/error'; | ||
import { relative } from 'pathe'; | ||
import { toArray } from '@vitest/utils'; | ||
@@ -94,2 +95,18 @@ | ||
} | ||
function createFileTask(filepath, root, projectName) { | ||
const path = relative(root, filepath); | ||
const file = { | ||
id: generateHash(`${path}${projectName || ""}`), | ||
name: path, | ||
type: "suite", | ||
mode: "run", | ||
filepath, | ||
tasks: [], | ||
meta: /* @__PURE__ */ Object.create(null), | ||
projectName, | ||
file: void 0 | ||
}; | ||
file.file = file; | ||
return file; | ||
} | ||
@@ -174,2 +191,2 @@ function createChainable(keys, fn) { | ||
export { getTests as a, getTasks as b, calculateSuiteHash as c, getSuites as d, hasFailed as e, getNames as f, generateHash as g, hasTests as h, interpretTaskModes as i, createChainable as j, partitionSuiteChildren as p, someTasksAreOnly as s }; | ||
export { createFileTask as a, getTests as b, calculateSuiteHash as c, getTasks as d, getSuites as e, hasFailed as f, generateHash as g, hasTests as h, interpretTaskModes as i, getNames as j, createChainable as k, partitionSuiteChildren as p, someTasksAreOnly as s }; |
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-Ck0GpLiZ.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-Ck0GpLiZ.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-DqMVjp0M.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-DqMVjp0M.js'; | ||
import { Awaitable } from '@vitest/utils'; | ||
@@ -6,0 +6,0 @@ export { processError } from '@vitest/utils/error'; |
@@ -5,5 +5,5 @@ import limit from 'p-limit'; | ||
export { processError } from '@vitest/utils/error'; | ||
import { j as createChainable, g as generateHash, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, p as partitionSuiteChildren, h as hasTests, e as hasFailed } from './chunk-tasks.js'; | ||
import { relative } from 'pathe'; | ||
import { k as createChainable, a as createFileTask, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, p as partitionSuiteChildren, h as hasTests, f as hasFailed } from './chunk-tasks.js'; | ||
import { parseSingleStack } from '@vitest/utils/source-map'; | ||
import 'pathe'; | ||
@@ -216,3 +216,3 @@ const fnMap = /* @__PURE__ */ new WeakMap(); | ||
const props = splitByComma(_first).map((prop) => { | ||
return prop.replace(/\:.*|\=.*/g, ""); | ||
return prop.replace(/:.*|=.*/g, ""); | ||
}); | ||
@@ -419,3 +419,4 @@ const last = props.at(-1); | ||
tasks: [], | ||
meta: /* @__PURE__ */ Object.create(null) | ||
meta: /* @__PURE__ */ Object.create(null), | ||
concurrent: suiteOptions == null ? void 0 : suiteOptions.concurrent | ||
}; | ||
@@ -563,3 +564,3 @@ if (runner && includeLocation && runner.config.includeTaskLocation) { | ||
formatted = formatted.replace( | ||
/\$([$\w_.]+)/g, | ||
/\$([$\w.]+)/g, | ||
// https://github.com/chaijs/chai/pull/1490 | ||
@@ -620,18 +621,8 @@ (_, key) => { | ||
async function collectTests(paths, runner) { | ||
var _a; | ||
const files = []; | ||
const config = runner.config; | ||
for (const filepath of paths) { | ||
const path = relative(config.root, filepath); | ||
const file = { | ||
id: generateHash(`${path}${config.name || ""}`), | ||
name: path, | ||
type: "suite", | ||
mode: "run", | ||
filepath, | ||
tasks: [], | ||
meta: /* @__PURE__ */ Object.create(null), | ||
projectName: config.name, | ||
file: void 0 | ||
}; | ||
file.file = file; | ||
const file = createFileTask(filepath, config.root, config.name); | ||
(_a = runner.onCollectStart) == null ? void 0 : _a.call(runner, file); | ||
clearCollectorContext(filepath, runner); | ||
@@ -673,4 +664,4 @@ try { | ||
file.tasks.forEach((task) => { | ||
var _a; | ||
if (((_a = task.suite) == null ? void 0 : _a.id) === "") | ||
var _a2; | ||
if (((_a2 = task.suite) == null ? void 0 : _a2.id) === "") | ||
delete task.suite; | ||
@@ -930,4 +921,3 @@ }); | ||
if (tasksGroup[0].concurrent === true) { | ||
const mutex = limit(runner.config.maxConcurrency); | ||
await Promise.all(tasksGroup.map((c) => mutex(() => runSuiteChild(c, runner)))); | ||
await Promise.all(tasksGroup.map((c) => runSuiteChild(c, runner))); | ||
} else { | ||
@@ -973,5 +963,6 @@ const { sequence } = runner.config; | ||
} | ||
let limitMaxConcurrency; | ||
async function runSuiteChild(c, runner) { | ||
if (c.type === "test" || c.type === "custom") | ||
return runTest(c, runner); | ||
return limitMaxConcurrency(() => runTest(c, runner)); | ||
else if (c.type === "suite") | ||
@@ -982,2 +973,3 @@ return runSuite(c, runner); | ||
var _a, _b; | ||
limitMaxConcurrency ?? (limitMaxConcurrency = limit(runner.config.maxConcurrency)); | ||
for (const file of files) { | ||
@@ -984,0 +976,0 @@ if (!file.tasks.length && !runner.config.passWithNoTests) { |
@@ -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-Ck0GpLiZ.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-Ck0GpLiZ.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-DqMVjp0M.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-DqMVjp0M.js'; | ||
import { DiffOptions } from '@vitest/utils/diff'; | ||
@@ -41,2 +41,6 @@ import '@vitest/utils'; | ||
/** | ||
* Called after the file task was created but not collected yet. | ||
*/ | ||
onCollectStart?: (file: File) => unknown; | ||
/** | ||
* Called after collecting tests and before "onBeforeRun". | ||
@@ -43,0 +47,0 @@ */ |
@@ -1,3 +0,3 @@ | ||
import { S as Suite, T as Task, a as Test, C as Custom } from './tasks-Ck0GpLiZ.js'; | ||
export { b as ChainableFunction, c as createChainable } from './tasks-Ck0GpLiZ.js'; | ||
import { S as Suite, F as File, T as Task, a as Test, C as Custom } from './tasks-DqMVjp0M.js'; | ||
export { b as ChainableFunction, c as createChainable } from './tasks-DqMVjp0M.js'; | ||
import { Arrayable } from '@vitest/utils'; | ||
@@ -12,2 +12,3 @@ | ||
declare function calculateSuiteHash(parent: Suite): void; | ||
declare function createFileTask(filepath: string, root: string, projectName: string): File; | ||
@@ -26,2 +27,2 @@ /** | ||
export { calculateSuiteHash, generateHash, getNames, getSuites, getTasks, getTests, hasFailed, hasTests, interpretTaskModes, partitionSuiteChildren, someTasksAreOnly }; | ||
export { calculateSuiteHash, createFileTask, generateHash, getNames, getSuites, getTasks, getTests, hasFailed, hasTests, interpretTaskModes, partitionSuiteChildren, someTasksAreOnly }; |
@@ -1,3 +0,4 @@ | ||
export { c as calculateSuiteHash, j as createChainable, g as generateHash, f as getNames, d as getSuites, b as getTasks, a as getTests, e as hasFailed, h as hasTests, i as interpretTaskModes, p as partitionSuiteChildren, s as someTasksAreOnly } from './chunk-tasks.js'; | ||
export { c as calculateSuiteHash, k as createChainable, a as createFileTask, g as generateHash, j as getNames, e as getSuites, d as getTasks, b as getTests, f as hasFailed, h as hasTests, i as interpretTaskModes, p as partitionSuiteChildren, s as someTasksAreOnly } from './chunk-tasks.js'; | ||
import '@vitest/utils/error'; | ||
import 'pathe'; | ||
import '@vitest/utils'; |
{ | ||
"name": "@vitest/runner", | ||
"type": "module", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "Vitest test runner", | ||
@@ -43,3 +43,3 @@ "license": "MIT", | ||
"pathe": "^1.1.2", | ||
"@vitest/utils": "2.0.0-beta.2" | ||
"@vitest/utils": "2.0.0-beta.3" | ||
}, | ||
@@ -46,0 +46,0 @@ "scripts": { |
65492
1657
+ Added@vitest/utils@2.0.0-beta.3(transitive)
- Removed@vitest/utils@2.0.0-beta.2(transitive)
Updated@vitest/utils@2.0.0-beta.3