@vitest/runner
Advanced tools
Comparing version 0.31.1 to 0.31.2
@@ -57,2 +57,3 @@ import limit from 'p-limit'; | ||
context.meta = test; | ||
context.task = test; | ||
context.onTestFailed = (fn) => { | ||
@@ -69,3 +70,3 @@ test.onFailed || (test.onFailed = []); | ||
var version = "0.31.1"; | ||
var version = "0.31.2"; | ||
@@ -126,3 +127,3 @@ function getVersion() { | ||
function createSuiteCollector(name, factory = () => { | ||
}, mode, concurrent, shuffle, suiteOptions) { | ||
}, mode, concurrent, shuffle, each, suiteOptions) { | ||
const tasks = []; | ||
@@ -140,2 +141,3 @@ const factoryQueue = []; | ||
retry: suiteOptions.retry, | ||
timeout: suiteOptions.timeout, | ||
...options | ||
@@ -148,2 +150,3 @@ }; | ||
name: name2, | ||
each: this.each, | ||
mode: mode2, | ||
@@ -153,3 +156,4 @@ suite: void 0, | ||
retry: options == null ? void 0 : options.retry, | ||
repeats: options == null ? void 0 : options.repeats | ||
repeats: options == null ? void 0 : options.repeats, | ||
meta: /* @__PURE__ */ Object.create(null) | ||
}; | ||
@@ -177,3 +181,4 @@ if (this.concurrent || concurrent) | ||
type: "custom", | ||
mode: self.only ? "only" : self.skip ? "skip" : self.todo ? "todo" : "run" | ||
mode: self.only ? "only" : self.skip ? "skip" : self.todo ? "todo" : "run", | ||
meta: /* @__PURE__ */ Object.create(null) | ||
}; | ||
@@ -206,4 +211,6 @@ tasks.push(task); | ||
mode, | ||
each, | ||
shuffle, | ||
tasks: [] | ||
tasks: [], | ||
meta: /* @__PURE__ */ Object.create(null) | ||
}; | ||
@@ -247,6 +254,7 @@ setHooks(suite2, createSuiteHooks()); | ||
} | ||
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, options); | ||
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, this.each, options); | ||
} | ||
suiteFn.each = function(cases, ...args) { | ||
const suite2 = this.withContext(); | ||
this.setContext("each", true); | ||
if (Array.isArray(cases) && args.length) | ||
@@ -260,2 +268,3 @@ cases = formatTemplateString(cases, args); | ||
}); | ||
this.setContext("each", void 0); | ||
}; | ||
@@ -274,2 +283,3 @@ }; | ||
const test2 = this.withContext(); | ||
this.setContext("each", true); | ||
if (Array.isArray(cases) && args.length) | ||
@@ -283,2 +293,3 @@ cases = formatTemplateString(cases, args); | ||
}); | ||
this.setContext("each", void 0); | ||
}; | ||
@@ -350,2 +361,3 @@ }; | ||
tasks: [], | ||
meta: /* @__PURE__ */ Object.create(null), | ||
projectName: config.name | ||
@@ -447,3 +459,3 @@ }; | ||
function updateTask(task, runner) { | ||
packs.set(task.id, task.result); | ||
packs.set(task.id, [task.result, task.meta]); | ||
const { clearTimeout, setTimeout } = getSafeTimers(); | ||
@@ -461,3 +473,10 @@ clearTimeout(updateTimer); | ||
if (packs.size) { | ||
const p = (_a = runner.onTaskUpdate) == null ? void 0 : _a.call(runner, Array.from(packs)); | ||
const taskPacks = Array.from(packs).map(([id, task]) => { | ||
return [ | ||
id, | ||
task[0], | ||
task[1] | ||
]; | ||
}); | ||
const p = (_a = runner.onTaskUpdate) == null ? void 0 : _a.call(runner, taskPacks); | ||
packs.clear(); | ||
@@ -464,0 +483,0 @@ return p; |
@@ -93,4 +93,4 @@ import { format, deepClone, stringify, getOwnProperties, getType, toArray } from '@vitest/utils'; | ||
err.nameStr = String(err.name); | ||
const clonedActual = deepClone(err.actual); | ||
const clonedExpected = deepClone(err.expected); | ||
const clonedActual = deepClone(err.actual, { forceWritable: true }); | ||
const clonedExpected = deepClone(err.expected, { forceWritable: true }); | ||
const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected); | ||
@@ -242,2 +242,5 @@ if (err.showDiff || err.showDiff === void 0 && err.expected !== void 0 && err.actual !== void 0) | ||
chain2.withContext = () => chain2.bind(context); | ||
chain2.setContext = (key, value) => { | ||
context[key] = value; | ||
}; | ||
for (const key of keys) { | ||
@@ -244,0 +247,0 @@ Object.defineProperty(chain2, key, { |
@@ -1,5 +0,5 @@ | ||
import { V as VitestRunner } from './runner-a2cd0770.js'; | ||
export { C as CancelReason, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-a2cd0770.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-891047e7.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-891047e7.js'; | ||
import { V as VitestRunner } from './runner-6af7d148.js'; | ||
export { C as CancelReason, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-6af7d148.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-900f5000.js'; | ||
export { D as DoneCallback, n as HookCleanupCallback, H as HookListener, R as RunMode, p as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, k as Suite, o as SuiteFactory, f as TaskBase, h as TaskCustom, g as TaskMeta, i as TaskResult, j as TaskResultPack, e as TaskState, q as TestContext, l as TestFunction, m as TestOptions } from './tasks-900f5000.js'; | ||
import { Awaitable } from '@vitest/utils'; | ||
@@ -6,0 +6,0 @@ |
@@ -57,2 +57,3 @@ import limit from 'p-limit'; | ||
context.meta = test; | ||
context.task = test; | ||
context.onTestFailed = (fn) => { | ||
@@ -69,3 +70,3 @@ test.onFailed || (test.onFailed = []); | ||
var version = "0.31.1"; | ||
var version = "0.31.2"; | ||
@@ -126,3 +127,3 @@ function getVersion() { | ||
function createSuiteCollector(name, factory = () => { | ||
}, mode, concurrent, shuffle, suiteOptions) { | ||
}, mode, concurrent, shuffle, each, suiteOptions) { | ||
const tasks = []; | ||
@@ -140,2 +141,3 @@ const factoryQueue = []; | ||
retry: suiteOptions.retry, | ||
timeout: suiteOptions.timeout, | ||
...options | ||
@@ -148,2 +150,3 @@ }; | ||
name: name2, | ||
each: this.each, | ||
mode: mode2, | ||
@@ -153,3 +156,4 @@ suite: void 0, | ||
retry: options == null ? void 0 : options.retry, | ||
repeats: options == null ? void 0 : options.repeats | ||
repeats: options == null ? void 0 : options.repeats, | ||
meta: /* @__PURE__ */ Object.create(null) | ||
}; | ||
@@ -177,3 +181,4 @@ if (this.concurrent || concurrent) | ||
type: "custom", | ||
mode: self.only ? "only" : self.skip ? "skip" : self.todo ? "todo" : "run" | ||
mode: self.only ? "only" : self.skip ? "skip" : self.todo ? "todo" : "run", | ||
meta: /* @__PURE__ */ Object.create(null) | ||
}; | ||
@@ -206,4 +211,6 @@ tasks.push(task); | ||
mode, | ||
each, | ||
shuffle, | ||
tasks: [] | ||
tasks: [], | ||
meta: /* @__PURE__ */ Object.create(null) | ||
}; | ||
@@ -247,6 +254,7 @@ setHooks(suite2, createSuiteHooks()); | ||
} | ||
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, options); | ||
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, this.each, options); | ||
} | ||
suiteFn.each = function(cases, ...args) { | ||
const suite2 = this.withContext(); | ||
this.setContext("each", true); | ||
if (Array.isArray(cases) && args.length) | ||
@@ -260,2 +268,3 @@ cases = formatTemplateString(cases, args); | ||
}); | ||
this.setContext("each", void 0); | ||
}; | ||
@@ -274,2 +283,3 @@ }; | ||
const test2 = this.withContext(); | ||
this.setContext("each", true); | ||
if (Array.isArray(cases) && args.length) | ||
@@ -283,2 +293,3 @@ cases = formatTemplateString(cases, args); | ||
}); | ||
this.setContext("each", void 0); | ||
}; | ||
@@ -350,2 +361,3 @@ }; | ||
tasks: [], | ||
meta: /* @__PURE__ */ Object.create(null), | ||
projectName: config.name | ||
@@ -447,3 +459,3 @@ }; | ||
function updateTask(task, runner) { | ||
packs.set(task.id, task.result); | ||
packs.set(task.id, [task.result, task.meta]); | ||
const { clearTimeout, setTimeout } = getSafeTimers(); | ||
@@ -461,3 +473,10 @@ clearTimeout(updateTimer); | ||
if (packs.size) { | ||
const p = (_a = runner.onTaskUpdate) == null ? void 0 : _a.call(runner, Array.from(packs)); | ||
const taskPacks = Array.from(packs).map(([id, task]) => { | ||
return [ | ||
id, | ||
task[0], | ||
task[1] | ||
]; | ||
}); | ||
const p = (_a = runner.onTaskUpdate) == null ? void 0 : _a.call(runner, taskPacks); | ||
packs.clear(); | ||
@@ -464,0 +483,0 @@ return p; |
@@ -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-891047e7.js'; | ||
export { C as CancelReason, V as VitestRunner, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-a2cd0770.js'; | ||
export { D as DoneCallback, F as File, n as HookCleanupCallback, H as HookListener, O as OnTestFailedHandler, R as RunMode, p as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, k as Suite, S as SuiteAPI, b as SuiteCollector, o as SuiteFactory, c as SuiteHooks, T as Task, f as TaskBase, h as TaskCustom, g as TaskMeta, i as TaskResult, j as TaskResultPack, e as TaskState, d as Test, a as TestAPI, q as TestContext, l as TestFunction, m as TestOptions } from './tasks-900f5000.js'; | ||
export { C as CancelReason, V as VitestRunner, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-6af7d148.js'; | ||
import '@vitest/utils'; |
@@ -1,3 +0,3 @@ | ||
import { j as Suite, T as Task, d as Test, g as TaskCustom } from './tasks-891047e7.js'; | ||
export { C as ChainableFunction, s as createChainable } from './tasks-891047e7.js'; | ||
import { k as Suite, T as Task, d as Test, h as TaskCustom } from './tasks-900f5000.js'; | ||
export { C as ChainableFunction, t as createChainable } from './tasks-900f5000.js'; | ||
import { Arrayable } from '@vitest/utils'; | ||
@@ -4,0 +4,0 @@ export { ErrorWithDiff, ParsedStack } from '@vitest/utils'; |
{ | ||
"name": "@vitest/runner", | ||
"type": "module", | ||
"version": "0.31.1", | ||
"version": "0.31.2", | ||
"description": "Vitest test runner", | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
"pathe": "^1.1.0", | ||
"@vitest/utils": "0.31.1" | ||
"@vitest/utils": "0.31.2" | ||
}, | ||
@@ -47,0 +47,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
75484
2036
+ Added@vitest/utils@0.31.2(transitive)
- Removed@vitest/utils@0.31.1(transitive)
Updated@vitest/utils@0.31.2