@vitest/runner 3.0.0-beta.2 → 3.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,8 +72,8 @@ function interpretTaskModes(file, namePattern, testLocations, onlyMode, parentIs
72
72
  }
73
73
  }
74
74
  });
75
- if (suite.mode === "run") {
76
- if (suite.tasks.length && suite.tasks.every((i) => i.mode !== "run")) {
75
+ if (suite.mode === "run" || suite.mode === "queued") {
76
+ if (suite.tasks.length && suite.tasks.every((i) => i.mode !== "run" && i.mode !== "queued")) {
77
77
  suite.mode = "skip";
78
78
  }
79
79
  }
@@ -106,7 +106,7 @@ function someTasksAreOnly(suite) {
106
106
  }
107
107
  function skipAllTasks(suite) {
108
108
  suite.tasks.forEach((t) => {
109
- if (t.mode === "run") {
109
+ if (t.mode === "run" || t.mode === "queued") {
110
110
  t.mode = "skip";
111
111
  if (t.type === "suite") {
112
112
  skipAllTasks(t);
@@ -154,7 +154,7 @@ function createFileTask(filepath, root, projectName, pool) {
154
154
  id: generateFileHash(path, projectName),
155
155
  name: path,
156
156
  type: "suite",
157
- mode: "run",
157
+ mode: "queued",
158
158
  filepath,
159
159
  tasks: [],
160
160
  meta: /* @__PURE__ */ Object.create(null),
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BeforeAllListener, A as AfterAllListener, b as BeforeEachListener, d as AfterEachListener, e as TaskHook, O as OnTestFailedHandler, f as OnTestFinishedHandler, a as Test, g 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-DaEhEbK_.js';
2
- 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-DaEhEbK_.js';
1
+ import { B as BeforeAllListener, A as AfterAllListener, b as BeforeEachListener, d as AfterEachListener, e as TaskHook, O as OnTestFailedHandler, f as OnTestFinishedHandler, a as Test, g 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-B64RTJlW.js';
2
+ 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-B64RTJlW.js';
3
3
  import { Awaitable } from '@vitest/utils';
4
4
  import { VitestRunner, FileSpecification } from './types.js';
5
5
  export { CancelReason, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource } from './types.js';
package/dist/index.js CHANGED
@@ -910,6 +910,9 @@ async function collectTests(specs, runner) {
910
910
  false,
911
911
  config.allowOnly
912
912
  );
913
+ if (file.mode === "queued") {
914
+ file.mode = "run";
915
+ }
913
916
  files.push(file);
914
917
  }
915
918
  return files;
@@ -1044,7 +1047,7 @@ async function callCleanupHooks(cleanups) {
1044
1047
  async function runTest(test, runner) {
1045
1048
  var _a, _b, _c, _d, _e, _f, _g, _h;
1046
1049
  await ((_a = runner.onBeforeRunTask) == null ? void 0 : _a.call(runner, test));
1047
- if (test.mode !== "run") {
1050
+ if (test.mode !== "run" && test.mode !== "queued") {
1048
1051
  return;
1049
1052
  }
1050
1053
  if (((_b = test.result) == null ? void 0 : _b.state) === "fail") {
@@ -1251,7 +1254,7 @@ async function runSuite(suite, runner) {
1251
1254
  } catch (e) {
1252
1255
  failTask(suite.result, e, runner.config.diffOptions);
1253
1256
  }
1254
- if (suite.mode === "run") {
1257
+ if (suite.mode === "run" || suite.mode === "queued") {
1255
1258
  if (!runner.config.passWithNoTests && !hasTests(suite)) {
1256
1259
  suite.result.state = "fail";
1257
1260
  if (!((_c = suite.result.errors) == null ? void 0 : _c.length)) {
@@ -3,10 +3,6 @@ import { ErrorWithDiff, Awaitable } from '@vitest/utils';
3
3
  interface FixtureItem extends FixtureOptions {
4
4
  prop: string;
5
5
  value: any;
6
- /**
7
- * Indicated if the injected value should be preferred over the fixture value
8
- */
9
- injected?: boolean;
10
6
  /**
11
7
  * Indicates whether the fixture is a function
12
8
  */
@@ -24,7 +20,7 @@ type ChainableFunction<T extends string, F extends (...args: any) => any, C = ob
24
20
  } & C;
25
21
  declare function createChainable<T extends string, Args extends any[], R = any>(keys: T[], fn: (this: Record<T, any>, ...args: Args) => R): ChainableFunction<T, (...args: Args) => R>;
26
22
 
27
- type RunMode = 'run' | 'skip' | 'only' | 'todo';
23
+ type RunMode = 'run' | 'skip' | 'only' | 'todo' | 'queued';
28
24
  type TaskState = RunMode | 'pass' | 'fail';
29
25
  interface TaskBase {
30
26
  /**
@@ -44,6 +40,7 @@ interface TaskBase {
44
40
  * - **only**: only this task and other tasks with `only` mode will run
45
41
  * - **todo**: task is marked as a todo, alias for `skip`
46
42
  * - **run**: task will run or already ran
43
+ * - **queued**: task will start running next. It can only exist on the File
47
44
  */
48
45
  mode: RunMode;
49
46
  /**
@@ -344,6 +341,10 @@ interface FixtureOptions {
344
341
  * Whether to automatically set up current fixture, even though it's not being used in tests.
345
342
  */
346
343
  auto?: boolean;
344
+ /**
345
+ * Indicated if the injected value from the config should be preferred over the fixture value
346
+ */
347
+ injected?: boolean;
347
348
  }
348
349
  type Use<T> = (value: T) => Promise<void>;
349
350
  type FixtureFn<T, K extends keyof T, ExtraContext> = (context: Omit<T, K> & ExtraContext, use: Use<T[K]>) => Promise<void>;
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DiffOptions } from '@vitest/utils/diff';
2
- import { r as SequenceHooks, s as SequenceSetupFiles, F as File, T as Task, a as Test, S as Suite, G as TaskResultPack, K as TestContext } from './tasks-DaEhEbK_.js';
3
- export { A as AfterAllListener, d as AfterEachListener, B as BeforeAllListener, b as BeforeEachListener, g as Custom, j as CustomAPI, 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, O as OnTestFailedHandler, f as OnTestFinishedHandler, R as RunMode, q as RuntimeContext, i as SuiteAPI, k as SuiteCollector, t as SuiteFactory, h as SuiteHooks, u as TaskBase, v as TaskContext, w as TaskCustomOptions, e as TaskHook, x as TaskMeta, y as TaskPopulated, z as TaskResult, J as TaskState, j as TestAPI, L as TestFunction, M as TestOptions, U as Use } from './tasks-DaEhEbK_.js';
2
+ import { r as SequenceHooks, s as SequenceSetupFiles, F as File, T as Task, a as Test, S as Suite, G as TaskResultPack, K as TestContext } from './tasks-B64RTJlW.js';
3
+ export { A as AfterAllListener, d as AfterEachListener, B as BeforeAllListener, b as BeforeEachListener, g as Custom, j as CustomAPI, 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, O as OnTestFailedHandler, f as OnTestFinishedHandler, R as RunMode, q as RuntimeContext, i as SuiteAPI, k as SuiteCollector, t as SuiteFactory, h as SuiteHooks, u as TaskBase, v as TaskContext, w as TaskCustomOptions, e as TaskHook, x as TaskMeta, y as TaskPopulated, z as TaskResult, J as TaskState, j as TestAPI, L as TestFunction, M as TestOptions, U as Use } from './tasks-B64RTJlW.js';
4
4
  import '@vitest/utils';
5
5
 
6
6
  /**
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as Suite, F as File, T as Task, a as Test } from './tasks-DaEhEbK_.js';
2
- export { C as ChainableFunction, c as createChainable } from './tasks-DaEhEbK_.js';
1
+ import { S as Suite, F as File, T as Task, a as Test } from './tasks-B64RTJlW.js';
2
+ export { C as ChainableFunction, c as createChainable } from './tasks-B64RTJlW.js';
3
3
  import { Arrayable } from '@vitest/utils';
4
4
 
5
5
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/runner",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.2",
4
+ "version": "3.0.0-beta.3",
5
5
  "description": "Vitest test runner",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -39,7 +39,7 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "pathe": "^1.1.2",
42
- "@vitest/utils": "3.0.0-beta.2"
42
+ "@vitest/utils": "3.0.0-beta.3"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "rimraf dist && rollup -c",