@vitest/runner
Advanced tools
Comparing version 0.31.0 to 0.31.1
@@ -68,5 +68,25 @@ import limit from 'p-limit'; | ||
var version = "0.31.1"; | ||
function getVersion() { | ||
return globalThis.__vitest_runner_version__ || version; | ||
} | ||
function markVersion() { | ||
globalThis.__vitest_runner_version__ = version; | ||
} | ||
function checkVersion() { | ||
const collectVersion = getVersion(); | ||
if (collectVersion !== version) { | ||
const error = `Version mismatch: Vitest started as ${collectVersion}, but tests are collected with ${version} version. | ||
- If you are using global Vitest, make sure your package has the same version. | ||
- If you have a monorepo setup, make sure your main package has the same version as your test packages.`; | ||
throw new Error(error); | ||
} | ||
} | ||
const suite = createSuite(); | ||
const test = createTest( | ||
function(name, fn, options) { | ||
checkVersion(); | ||
getCurrentSuite().test.fn.call(this, name, fn, options); | ||
@@ -110,3 +130,3 @@ } | ||
initSuite(); | ||
const test2 = createTest(function(name2, fn = noop, options = suiteOptions) { | ||
const test2 = createTest(function(name2, fn = noop, options) { | ||
const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run"; | ||
@@ -117,3 +137,4 @@ if (typeof options === "number") | ||
options = { | ||
...suiteOptions, | ||
repeats: suiteOptions.repeats, | ||
retry: suiteOptions.retry, | ||
...options | ||
@@ -162,2 +183,3 @@ }; | ||
mode, | ||
options: suiteOptions, | ||
test: test2, | ||
@@ -212,3 +234,11 @@ tasks, | ||
function suiteFn(name, factory, options) { | ||
var _a; | ||
checkVersion(); | ||
const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run"; | ||
const currentSuite = getCurrentSuite(); | ||
if (typeof options === "number") | ||
options = { timeout: options }; | ||
if (currentSuite && typeof ((_a = currentSuite.options) == null ? void 0 : _a.repeats) === "number") { | ||
options = { repeats: currentSuite.options.repeats, ...options }; | ||
} | ||
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, options); | ||
@@ -625,2 +655,3 @@ } | ||
var _a, _b, _c, _d; | ||
markVersion(); | ||
await ((_a = runner.onBeforeCollect) == null ? void 0 : _a.call(runner, paths)); | ||
@@ -627,0 +658,0 @@ const files = await collectTests(paths, runner); |
@@ -88,3 +88,3 @@ import { format, deepClone, stringify, getOwnProperties, getType, toArray } from '@vitest/utils'; | ||
if (!err || typeof err !== "object") | ||
return err; | ||
return { message: err }; | ||
if (err.stack) | ||
@@ -91,0 +91,0 @@ err.stackStr = String(err.stack); |
@@ -1,5 +0,5 @@ | ||
import { V as VitestRunner } from './runner-7aa38127.js'; | ||
export { C as CancelReason, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-7aa38127.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-2a410173.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-2a410173.js'; | ||
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 { Awaitable } from '@vitest/utils'; | ||
@@ -6,0 +6,0 @@ |
@@ -68,5 +68,25 @@ import limit from 'p-limit'; | ||
var version = "0.31.1"; | ||
function getVersion() { | ||
return globalThis.__vitest_runner_version__ || version; | ||
} | ||
function markVersion() { | ||
globalThis.__vitest_runner_version__ = version; | ||
} | ||
function checkVersion() { | ||
const collectVersion = getVersion(); | ||
if (collectVersion !== version) { | ||
const error = `Version mismatch: Vitest started as ${collectVersion}, but tests are collected with ${version} version. | ||
- If you are using global Vitest, make sure your package has the same version. | ||
- If you have a monorepo setup, make sure your main package has the same version as your test packages.`; | ||
throw new Error(error); | ||
} | ||
} | ||
const suite = createSuite(); | ||
const test = createTest( | ||
function(name, fn, options) { | ||
checkVersion(); | ||
getCurrentSuite().test.fn.call(this, name, fn, options); | ||
@@ -110,3 +130,3 @@ } | ||
initSuite(); | ||
const test2 = createTest(function(name2, fn = noop, options = suiteOptions) { | ||
const test2 = createTest(function(name2, fn = noop, options) { | ||
const mode2 = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run"; | ||
@@ -117,3 +137,4 @@ if (typeof options === "number") | ||
options = { | ||
...suiteOptions, | ||
repeats: suiteOptions.repeats, | ||
retry: suiteOptions.retry, | ||
...options | ||
@@ -162,2 +183,3 @@ }; | ||
mode, | ||
options: suiteOptions, | ||
test: test2, | ||
@@ -212,3 +234,11 @@ tasks, | ||
function suiteFn(name, factory, options) { | ||
var _a; | ||
checkVersion(); | ||
const mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run"; | ||
const currentSuite = getCurrentSuite(); | ||
if (typeof options === "number") | ||
options = { timeout: options }; | ||
if (currentSuite && typeof ((_a = currentSuite.options) == null ? void 0 : _a.repeats) === "number") { | ||
options = { repeats: currentSuite.options.repeats, ...options }; | ||
} | ||
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, options); | ||
@@ -625,2 +655,3 @@ } | ||
var _a, _b, _c, _d; | ||
markVersion(); | ||
await ((_a = runner.onBeforeCollect) == null ? void 0 : _a.call(runner, paths)); | ||
@@ -627,0 +658,0 @@ const files = await collectTests(paths, runner); |
@@ -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-2a410173.js'; | ||
export { C as CancelReason, V as VitestRunner, a as VitestRunnerConfig, c as VitestRunnerConstructor, b as VitestRunnerImportSource } from './runner-7aa38127.js'; | ||
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'; | ||
import '@vitest/utils'; |
@@ -1,3 +0,3 @@ | ||
import { j as Suite, T as Task, d as Test, g as TaskCustom } from './tasks-2a410173.js'; | ||
export { C as ChainableFunction, s as createChainable } from './tasks-2a410173.js'; | ||
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 { Arrayable } from '@vitest/utils'; | ||
@@ -4,0 +4,0 @@ export { ErrorWithDiff, ParsedStack } from '@vitest/utils'; |
{ | ||
"name": "@vitest/runner", | ||
"type": "module", | ||
"version": "0.31.0", | ||
"version": "0.31.1", | ||
"description": "Vitest test runner", | ||
@@ -44,3 +44,3 @@ "license": "MIT", | ||
"pathe": "^1.1.0", | ||
"@vitest/utils": "0.31.0" | ||
"@vitest/utils": "0.31.1" | ||
}, | ||
@@ -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
73896
1986
+ Added@vitest/utils@0.31.1(transitive)
- Removed@vitest/utils@0.31.0(transitive)
Updated@vitest/utils@0.31.1