@vitest/runner
Advanced tools
Comparing version 2.1.5 to 2.2.0-beta.1
@@ -1,3 +0,3 @@ | ||
import { B as BeforeAllListener, A as AfterAllListener, d as BeforeEachListener, e as AfterEachListener, f as TaskHook, O as OnTestFailedHandler, g as OnTestFinishedHandler, a as Test, C as Custom, S as Suite, h as SuiteHooks, T as Task, F as File, i as SuiteAPI, j as TestAPI, k as SuiteCollector } from './tasks-3ZnPj1LR.js'; | ||
export { D as DoneCallback, E as ExtendedContext, l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, I as InferFixturesTypes, R as RunMode, q as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, t as SuiteFactory, u as TaskBase, v as TaskContext, w as TaskCustomOptions, x as TaskMeta, y as TaskPopulated, z as TaskResult, G as TaskResultPack, J as TaskState, K as TestContext, L as TestFunction, M as TestOptions, U as Use } from './tasks-3ZnPj1LR.js'; | ||
import { B as BeforeAllListener, A as AfterAllListener, d as BeforeEachListener, e as AfterEachListener, f as TaskHook, O as OnTestFailedHandler, g as OnTestFinishedHandler, a as Test, C as Custom, S as Suite, h as SuiteHooks, T as Task, F as File, i as SuiteAPI, j as TestAPI, k as SuiteCollector } from './tasks-F_411-nA.js'; | ||
export { D as DoneCallback, E as ExtendedContext, l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, I as InferFixturesTypes, R as RunMode, q as RuntimeContext, r as SequenceHooks, s as SequenceSetupFiles, t as SuiteFactory, u as TaskBase, v as TaskContext, w as TaskCustomOptions, x as TaskMeta, y as TaskPopulated, z as TaskResult, G as TaskResultPack, J as TaskState, K as TestContext, L as TestFunction, M as TestOptions, U as Use } from './tasks-F_411-nA.js'; | ||
import { Awaitable } from '@vitest/utils'; | ||
@@ -4,0 +4,0 @@ import { VitestRunner } from './types.js'; |
@@ -9,5 +9,6 @@ import { getSafeTimers, isObject, createDefer, isNegativeNaN, format, objDisplay, objectAttr, toArray, assertTypes, shuffle } from '@vitest/utils'; | ||
class PendingError extends Error { | ||
constructor(message, task) { | ||
constructor(message, task, note) { | ||
super(message); | ||
this.message = message; | ||
this.note = note; | ||
this.taskId = task.id; | ||
@@ -58,5 +59,5 @@ } | ||
context.task = test; | ||
context.skip = () => { | ||
context.skip = (note) => { | ||
test.pending = true; | ||
throw new PendingError("test is skipped; abort execution", test); | ||
throw new PendingError("test is skipped; abort execution", test, note); | ||
}; | ||
@@ -100,4 +101,4 @@ context.onTestFailed = (fn) => { | ||
function mergeContextFixtures(fixtures, context = {}) { | ||
const fixtureOptionKeys = ["auto"]; | ||
function mergeContextFixtures(fixtures, context, inject) { | ||
const fixtureOptionKeys = ["auto", "injected"]; | ||
const fixtureArray = Object.entries(fixtures).map( | ||
@@ -108,3 +109,4 @@ ([prop, value]) => { | ||
Object.assign(fixtureItem, value[1]); | ||
fixtureItem.value = value[0]; | ||
const userValue = value[0]; | ||
fixtureItem.value = fixtureItem.injected ? inject(prop) ?? userValue : userValue; | ||
} | ||
@@ -673,3 +675,10 @@ fixtureItem.prop = prop; | ||
taskFn.extend = function(fixtures) { | ||
const _context = mergeContextFixtures(fixtures, context); | ||
const _context = mergeContextFixtures( | ||
fixtures, | ||
context || {}, | ||
(key) => { | ||
var _a, _b; | ||
return (_b = (_a = getRunner()).injectValue) == null ? void 0 : _b.call(_a, key); | ||
} | ||
); | ||
return createTest(function fn2(name, optionsOrFn, optionsOrTest) { | ||
@@ -1016,3 +1025,3 @@ getCurrentSuite().test.fn.call( | ||
async function runTest(test, runner) { | ||
var _a, _b, _c, _d, _e, _f, _g; | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
await ((_a = runner.onBeforeRunTask) == null ? void 0 : _a.call(runner, test)); | ||
@@ -1080,3 +1089,3 @@ if (test.mode !== "run") { | ||
test.mode = "skip"; | ||
test.result = { state: "skip" }; | ||
test.result = { state: "skip", note: (_f = test.result) == null ? void 0 : _f.note }; | ||
updateTask(test, runner); | ||
@@ -1087,3 +1096,3 @@ setCurrentTest(void 0); | ||
try { | ||
await ((_f = runner.onTaskFinished) == null ? void 0 : _f.call(runner, test)); | ||
await ((_g = runner.onTaskFinished) == null ? void 0 : _g.call(runner, test)); | ||
} catch (e) { | ||
@@ -1135,3 +1144,3 @@ failTask(test.result, e, runner.config.diffOptions); | ||
test.result.duration = now() - start; | ||
await ((_g = runner.onAfterRunTask) == null ? void 0 : _g.call(runner, test)); | ||
await ((_h = runner.onAfterRunTask) == null ? void 0 : _h.call(runner, test)); | ||
updateTask(test, runner); | ||
@@ -1142,2 +1151,3 @@ } | ||
result.state = "skip"; | ||
result.note = err.note; | ||
return; | ||
@@ -1144,0 +1154,0 @@ } |
import { DiffOptions } from '@vitest/utils/diff'; | ||
import { r as SequenceHooks, s as SequenceSetupFiles, F as File, T as Task, a as Test, C as Custom, S as Suite, G as TaskResultPack, v as TaskContext, E as ExtendedContext } from './tasks-3ZnPj1LR.js'; | ||
export { A as AfterAllListener, e as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, j as CustomAPI, D as DoneCallback, l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, g as OnTestFinishedHandler, R as RunMode, q as RuntimeContext, i as SuiteAPI, k as SuiteCollector, t as SuiteFactory, h as SuiteHooks, u as TaskBase, w as TaskCustomOptions, f as TaskHook, x as TaskMeta, y as TaskPopulated, z as TaskResult, J as TaskState, j as TestAPI, K as TestContext, L as TestFunction, M as TestOptions, U as Use } from './tasks-3ZnPj1LR.js'; | ||
import { r as SequenceHooks, s as SequenceSetupFiles, F as File, T as Task, a as Test, C as Custom, S as Suite, G as TaskResultPack, v as TaskContext, E as ExtendedContext } from './tasks-F_411-nA.js'; | ||
export { A as AfterAllListener, e as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, j as CustomAPI, D as DoneCallback, l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, I as InferFixturesTypes, O as OnTestFailedHandler, g as OnTestFinishedHandler, R as RunMode, q as RuntimeContext, i as SuiteAPI, k as SuiteCollector, t as SuiteFactory, h as SuiteHooks, u as TaskBase, w as TaskCustomOptions, f as TaskHook, x as TaskMeta, y as TaskPopulated, z as TaskResult, J as TaskState, j as TestAPI, K as TestContext, L as TestFunction, M as TestOptions, U as Use } from './tasks-F_411-nA.js'; | ||
import '@vitest/utils'; | ||
@@ -127,2 +127,6 @@ | ||
/** | ||
* Function that is called when the runner attempts to get the value when `test.extend` is used with `{ injected: true }` | ||
*/ | ||
injectValue?: (key: string) => unknown; | ||
/** | ||
* Publicly available configuration. | ||
@@ -129,0 +133,0 @@ */ |
@@ -1,3 +0,3 @@ | ||
import { S as Suite, F as File, T as Task, a as Test, C as Custom } from './tasks-3ZnPj1LR.js'; | ||
export { b as ChainableFunction, c as createChainable } from './tasks-3ZnPj1LR.js'; | ||
import { S as Suite, F as File, T as Task, a as Test, C as Custom } from './tasks-F_411-nA.js'; | ||
export { b as ChainableFunction, c as createChainable } from './tasks-F_411-nA.js'; | ||
import { Arrayable } from '@vitest/utils'; | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "@vitest/runner", | ||
"type": "module", | ||
"version": "2.1.5", | ||
"version": "2.2.0-beta.1", | ||
"description": "Vitest test runner", | ||
@@ -42,3 +42,3 @@ "license": "MIT", | ||
"pathe": "^1.1.2", | ||
"@vitest/utils": "2.1.5" | ||
"@vitest/utils": "2.2.0-beta.1" | ||
}, | ||
@@ -45,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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
90024
2435
1
+ Added@vitest/pretty-format@2.2.0-beta.1(transitive)
+ Added@vitest/utils@2.2.0-beta.1(transitive)
- Removed@vitest/pretty-format@2.1.5(transitive)
- Removed@vitest/utils@2.1.5(transitive)
Updated@vitest/utils@2.2.0-beta.1