@vitest/runner
Advanced tools
Comparing version 2.0.0-beta.12 to 2.0.0-beta.13
@@ -22,2 +22,29 @@ import { processError } from '@vitest/utils/error'; | ||
function limitConcurrency(concurrency = Infinity) { | ||
let count = 0; | ||
let head; | ||
let tail; | ||
const finish = () => { | ||
count--; | ||
if (head) { | ||
head[0](); | ||
head = head[1]; | ||
tail = head && tail; | ||
} | ||
}; | ||
return (func, ...args) => { | ||
return new Promise((resolve) => { | ||
if (count++ < concurrency) { | ||
resolve(); | ||
} else if (tail) { | ||
tail = tail[1] = [resolve]; | ||
} else { | ||
head = tail = [resolve]; | ||
} | ||
}).then(() => { | ||
return func(...args); | ||
}).finally(finish); | ||
}; | ||
} | ||
function interpretTaskModes(suite, namePattern, onlyMode, parentIsOnly, allowOnly) { | ||
@@ -110,3 +137,3 @@ const suiteIsOnly = parentIsOnly || suite.mode === "only"; | ||
} | ||
function createFileTask(filepath, root, projectName) { | ||
function createFileTask(filepath, root, projectName, pool) { | ||
const path = relative(root, filepath); | ||
@@ -122,3 +149,4 @@ const file = { | ||
projectName, | ||
file: void 0 | ||
file: void 0, | ||
pool | ||
}; | ||
@@ -218,2 +246,2 @@ file.file = file; | ||
export { createFileTask as a, isAtomTest as b, calculateSuiteHash as c, getTests as d, getTasks as e, getSuites as f, generateHash as g, hasTests as h, interpretTaskModes as i, hasFailed as j, getNames as k, createChainable as l, partitionSuiteChildren as p, someTasksAreOnly as s }; | ||
export { createFileTask as a, isAtomTest as b, calculateSuiteHash as c, getTests as d, getTasks as e, getSuites as f, generateHash as g, hasTests as h, interpretTaskModes as i, hasFailed as j, getNames as k, createChainable as l, limitConcurrency as m, 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-BP89OzIP.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-BP89OzIP.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-UPEJyRVL.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-UPEJyRVL.js'; | ||
import { Awaitable } from '@vitest/utils'; | ||
@@ -11,2 +11,3 @@ export { processError } from '@vitest/utils/error'; | ||
declare function startTests(paths: string[], runner: VitestRunner): Promise<File[]>; | ||
declare function publicCollect(paths: string[], runner: VitestRunner): Promise<File[]>; | ||
@@ -34,2 +35,2 @@ declare const suite: SuiteAPI; | ||
export { Custom, CustomAPI, File, OnTestFailedHandler, OnTestFinishedHandler, Suite, SuiteAPI, SuiteCollector, SuiteHooks, Task, Test, TestAPI, VitestRunner, afterAll, afterEach, beforeAll, beforeEach, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, onTestFailed, onTestFinished, setFn, setHooks, startTests, suite, test, updateTask }; | ||
export { Custom, CustomAPI, File, OnTestFailedHandler, OnTestFinishedHandler, Suite, SuiteAPI, SuiteCollector, SuiteHooks, Task, Test, TestAPI, VitestRunner, afterAll, afterEach, beforeAll, beforeEach, publicCollect as collectTests, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, onTestFailed, onTestFinished, setFn, setHooks, startTests, suite, test, updateTask }; |
@@ -1,6 +0,5 @@ | ||
import limit from 'p-limit'; | ||
import { getSafeTimers, isObject, createDefer, isNegativeNaN, format, objDisplay, objectAttr, toArray, shuffle } from '@vitest/utils'; | ||
import { processError } from '@vitest/utils/error'; | ||
export { processError } from '@vitest/utils/error'; | ||
import { l as createChainable, a as createFileTask, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, p as partitionSuiteChildren, h as hasTests, j as hasFailed } from './chunk-tasks.js'; | ||
import { l as createChainable, a as createFileTask, c as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, m as limitConcurrency, p as partitionSuiteChildren, h as hasTests, j as hasFailed } from './chunk-tasks.js'; | ||
import { parseSingleStack } from '@vitest/utils/source-map'; | ||
@@ -736,3 +735,3 @@ import 'pathe'; | ||
for (const filepath of paths) { | ||
const file = createFileTask(filepath, config.root, config.name); | ||
const file = createFileTask(filepath, config.root, config.name, runner.pool); | ||
(_a = runner.onCollectStart) == null ? void 0 : _a.call(runner, file); | ||
@@ -1141,3 +1140,3 @@ clearCollectorContext(filepath, runner); | ||
var _a, _b; | ||
limitMaxConcurrency ?? (limitMaxConcurrency = limit(runner.config.maxConcurrency)); | ||
limitMaxConcurrency ?? (limitMaxConcurrency = limitConcurrency(runner.config.maxConcurrency)); | ||
for (const file of files) { | ||
@@ -1169,2 +1168,9 @@ if (!file.tasks.length && !runner.config.passWithNoTests) { | ||
} | ||
async function publicCollect(paths, runner) { | ||
var _a, _b; | ||
await ((_a = runner.onBeforeCollect) == null ? void 0 : _a.call(runner, paths)); | ||
const files = await collectTests(paths, runner); | ||
await ((_b = runner.onCollected) == null ? void 0 : _b.call(runner, files)); | ||
return files; | ||
} | ||
@@ -1222,2 +1228,2 @@ function getDefaultHookTimeout() { | ||
export { afterAll, afterEach, beforeAll, beforeEach, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, onTestFailed, onTestFinished, setFn, setHooks, startTests, suite, test, updateTask }; | ||
export { afterAll, afterEach, beforeAll, beforeEach, publicCollect as collectTests, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, onTestFailed, onTestFinished, setFn, setHooks, startTests, suite, test, updateTask }; |
@@ -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-BP89OzIP.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-BP89OzIP.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-UPEJyRVL.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-UPEJyRVL.js'; | ||
import { DiffOptions } from '@vitest/utils/diff'; | ||
@@ -127,4 +127,8 @@ import '@vitest/utils'; | ||
config: VitestRunnerConfig; | ||
/** | ||
* The name of the current pool. Can affect how stack trace is inferred on the server side. | ||
*/ | ||
pool?: string; | ||
} | ||
export { type CancelReason, Custom, ExtendedContext, File, SequenceHooks, SequenceSetupFiles, Suite, Task, TaskContext, TaskResultPack, Test, type VitestRunner, type VitestRunnerConfig, type VitestRunnerConstructor, type VitestRunnerImportSource }; |
@@ -1,3 +0,3 @@ | ||
import { S as Suite, F as File, T as Task, a as Test, C as Custom } from './tasks-BP89OzIP.js'; | ||
export { b as ChainableFunction, c as createChainable } from './tasks-BP89OzIP.js'; | ||
import { S as Suite, F as File, T as Task, a as Test, C as Custom } from './tasks-UPEJyRVL.js'; | ||
export { b as ChainableFunction, c as createChainable } from './tasks-UPEJyRVL.js'; | ||
import { Arrayable } from '@vitest/utils'; | ||
@@ -12,3 +12,3 @@ | ||
declare function calculateSuiteHash(parent: Suite): void; | ||
declare function createFileTask(filepath: string, root: string, projectName: string): File; | ||
declare function createFileTask(filepath: string, root: string, projectName: string, pool?: string): File; | ||
@@ -28,2 +28,7 @@ /** | ||
export { calculateSuiteHash, createFileTask, generateHash, getNames, getSuites, getTasks, getTests, hasFailed, hasTests, interpretTaskModes, isAtomTest, partitionSuiteChildren, someTasksAreOnly }; | ||
/** | ||
* Return a function for running multiple async operations with limited concurrency. | ||
*/ | ||
declare function limitConcurrency(concurrency?: number): <Args extends unknown[], T>(func: (...args: Args) => PromiseLike<T> | T, ...args: Args) => Promise<T>; | ||
export { calculateSuiteHash, createFileTask, generateHash, getNames, getSuites, getTasks, getTests, hasFailed, hasTests, interpretTaskModes, isAtomTest, limitConcurrency, partitionSuiteChildren, someTasksAreOnly }; |
@@ -1,4 +0,4 @@ | ||
export { c as calculateSuiteHash, l as createChainable, a as createFileTask, g as generateHash, k as getNames, f as getSuites, e as getTasks, d as getTests, j as hasFailed, h as hasTests, i as interpretTaskModes, b as isAtomTest, p as partitionSuiteChildren, s as someTasksAreOnly } from './chunk-tasks.js'; | ||
export { c as calculateSuiteHash, l as createChainable, a as createFileTask, g as generateHash, k as getNames, f as getSuites, e as getTasks, d as getTests, j as hasFailed, h as hasTests, i as interpretTaskModes, b as isAtomTest, m as limitConcurrency, 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.12", | ||
"version": "2.0.0-beta.13", | ||
"description": "Vitest test runner", | ||
@@ -41,5 +41,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"p-limit": "^5.0.0", | ||
"pathe": "^1.1.2", | ||
"@vitest/utils": "2.0.0-beta.12" | ||
"@vitest/utils": "2.0.0-beta.13" | ||
}, | ||
@@ -46,0 +45,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70707
2
1947
+ Added@vitest/utils@2.0.0-beta.13(transitive)
- Removedp-limit@^5.0.0
- Removed@vitest/utils@2.0.0-beta.12(transitive)
- Removedp-limit@5.0.0(transitive)
- Removedyocto-queue@1.1.1(transitive)
Updated@vitest/utils@2.0.0-beta.13