@vitest/runner 4.1.5 → 4.1.7

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.
@@ -1768,7 +1768,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
1768
1768
  if (task.mode === "run" && !handler) {
1769
1769
  task.mode = "todo";
1770
1770
  }
1771
- if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) {
1771
+ if (options.concurrent ?? (!options.sequential && runner.config.sequence.concurrent)) {
1772
1772
  task.concurrent = true;
1773
1773
  }
1774
1774
  task.shuffle = suiteOptions?.shuffle;
@@ -3144,7 +3144,8 @@ async function runSuite(suite, runner) {
3144
3144
  } else {
3145
3145
  for (let tasksGroup of partitionSuiteChildren(suite)) {
3146
3146
  if (tasksGroup[0].concurrent === true) {
3147
- await Promise.all(tasksGroup.map((c) => runSuiteChild(c, runner)));
3147
+ const groupLimiter = limitConcurrency(runner.config.maxConcurrency);
3148
+ await Promise.all(tasksGroup.map((c) => groupLimiter(() => runSuiteChild(c, runner))));
3148
3149
  } else {
3149
3150
  const { sequence } = runner.config;
3150
3151
  if (suite.shuffle) {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TestArtifact, a as Test, S as Suite, b as SuiteHooks, F as FileSpecification, V as VitestRunner, c as File, d as TaskUpdateEvent, e as Task, f as TestAPI, g as SuiteAPI, h as SuiteCollector } from './tasks.d-Bh0IjN67.js';
2
- export { A as AfterAllListener, i as AfterEachListener, j as AroundAllListener, k as AroundEachListener, B as BeforeAllListener, l as BeforeEachListener, C as CancelReason, m as FailureScreenshotArtifact, n as Fixture, o as FixtureFn, p as FixtureOptions, q as Fixtures, I as ImportDuration, r as InferFixturesTypes, O as OnTestFailedHandler, s as OnTestFinishedHandler, R as Retry, t as RunMode, u as RuntimeContext, v as SequenceHooks, w as SequenceSetupFiles, x as SerializableRetry, y as SuiteFactory, z as SuiteOptions, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, W as TestArtifactBase, X as TestArtifactLocation, Y as TestArtifactRegistry, Z as TestAttachment, _ as TestContext, $ as TestFunction, a0 as TestOptions, a1 as TestTagDefinition, a2 as TestTags, a3 as Use, a4 as VisualRegressionArtifact, a5 as VitestRunnerConfig, a6 as VitestRunnerConstructor, a7 as VitestRunnerImportSource, a8 as afterAll, a9 as afterEach, aa as aroundAll, ab as aroundEach, ac as beforeAll, ad as beforeEach, ae as onTestFailed, af as onTestFinished } from './tasks.d-Bh0IjN67.js';
1
+ import { T as TestArtifact, a as Test, S as Suite, b as SuiteHooks, F as FileSpecification, V as VitestRunner, c as File, d as TaskUpdateEvent, e as Task, f as TestAPI, g as SuiteAPI, h as SuiteCollector } from './tasks.d-DEYaIMIu.js';
2
+ export { A as AfterAllListener, i as AfterEachListener, j as AroundAllListener, k as AroundEachListener, B as BeforeAllListener, l as BeforeEachListener, C as CancelReason, m as FailureScreenshotArtifact, n as Fixture, o as FixtureFn, p as FixtureOptions, q as Fixtures, I as ImportDuration, r as InferFixturesTypes, O as OnTestFailedHandler, s as OnTestFinishedHandler, R as Retry, t as RunMode, u as RuntimeContext, v as SequenceHooks, w as SequenceSetupFiles, x as SerializableRetry, y as SuiteFactory, z as SuiteOptions, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, W as TestArtifactBase, X as TestArtifactLocation, Y as TestArtifactRegistry, Z as TestAttachment, _ as TestContext, $ as TestFunction, a0 as TestOptions, a1 as TestTagDefinition, a2 as TestTags, a3 as Use, a4 as VisualRegressionArtifact, a5 as VitestRunnerConfig, a6 as VitestRunnerConstructor, a7 as VitestRunnerImportSource, a8 as afterAll, a9 as afterEach, aa as aroundAll, ab as aroundEach, ac as beforeAll, ad as beforeEach, ae as onTestFailed, af as onTestFinished } from './tasks.d-DEYaIMIu.js';
3
3
  import { Awaitable } from '@vitest/utils';
4
4
  import '@vitest/utils/diff';
5
5
 
@@ -401,6 +401,13 @@ type ChainableFunction<
401
401
  > = F & { [x in T] : ChainableFunction<T, F, C> } & {
402
402
  fn: (this: Record<T, any>, ...args: Parameters<F>) => ReturnType<F>;
403
403
  } & C;
404
+ type TypedChainableFunction<
405
+ T,
406
+ F extends (...args: any) => any,
407
+ C = object
408
+ > = F & { [x in keyof T] : TypedChainableFunction<T, F, C> } & {
409
+ fn: (this: Record<keyof T, any>, ...args: Parameters<F>) => ReturnType<F>;
410
+ } & C;
404
411
  declare function createChainable<
405
412
  T extends string,
406
413
  Args extends any[],
@@ -710,7 +717,8 @@ interface TestCollectorCallable<C = object> {
710
717
  <ExtraContext extends C>(name: string | Function, fn?: TestFunction<ExtraContext>, options?: number): void;
711
718
  <ExtraContext extends C>(name: string | Function, options?: TestCollectorOptions, fn?: TestFunction<ExtraContext>): void;
712
719
  }
713
- type ChainableTestAPI<ExtraContext = object> = ChainableFunction<"concurrent" | "sequential" | "only" | "skip" | "todo" | "fails", TestCollectorCallable<ExtraContext>, {
720
+ type ChainableTestContextMap = Pick<Required<TestOptions>, "concurrent" | "sequential" | "only" | "skip" | "todo" | "fails">;
721
+ type ChainableTestAPI<ExtraContext = object> = TypedChainableFunction<ChainableTestContextMap, TestCollectorCallable<ExtraContext>, {
714
722
  each: TestEachFunction;
715
723
  for: TestForFunction<ExtraContext>;
716
724
  }>;
@@ -792,6 +800,8 @@ interface TestOptions {
792
800
  /**
793
801
  * Whether tests run sequentially.
794
802
  * Tests inherit `sequential` from `describe()` and nested `describe()` will inherit from parent's `sequential`.
803
+ *
804
+ * @deprecated Use `concurrent: false` instead.
795
805
  */
796
806
  sequential?: boolean;
797
807
  /**
@@ -1190,7 +1200,8 @@ interface SuiteCollectorCallable<ExtraContext = object> {
1190
1200
  <OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, fn?: SuiteFactory<OverrideExtraContext>, options?: number): SuiteCollector<OverrideExtraContext>;
1191
1201
  <OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, options: SuiteOptions, fn?: SuiteFactory<OverrideExtraContext>): SuiteCollector<OverrideExtraContext>;
1192
1202
  }
1193
- type ChainableSuiteAPI<ExtraContext = object> = ChainableFunction<"concurrent" | "sequential" | "only" | "skip" | "todo" | "shuffle", SuiteCollectorCallable<ExtraContext>, {
1203
+ type ChainableSuiteContextMap = Pick<Required<SuiteOptions>, "concurrent" | "sequential" | "only" | "skip" | "todo" | "shuffle">;
1204
+ type ChainableSuiteAPI<ExtraContext = object> = TypedChainableFunction<ChainableSuiteContextMap, SuiteCollectorCallable<ExtraContext>, {
1194
1205
  each: TestEachFunction;
1195
1206
  for: SuiteForFunction;
1196
1207
  }>;
package/dist/types.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { A as AfterAllListener, i as AfterEachListener, j as AroundAllListener, k as AroundEachListener, B as BeforeAllListener, l as BeforeEachListener, C as CancelReason, m as FailureScreenshotArtifact, c as File, F as FileSpecification, n as Fixture, o as FixtureFn, p as FixtureOptions, q as Fixtures, I as ImportDuration, r as InferFixturesTypes, O as OnTestFailedHandler, s as OnTestFinishedHandler, R as Retry, t as RunMode, u as RuntimeContext, v as SequenceHooks, w as SequenceSetupFiles, x as SerializableRetry, S as Suite, g as SuiteAPI, h as SuiteCollector, y as SuiteFactory, b as SuiteHooks, z as SuiteOptions, e as Task, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, d as TaskUpdateEvent, a as Test, f as TestAPI, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, T as TestArtifact, W as TestArtifactBase, X as TestArtifactLocation, Y as TestArtifactRegistry, Z as TestAttachment, _ as TestContext, $ as TestFunction, a0 as TestOptions, a1 as TestTagDefinition, a2 as TestTags, a3 as Use, a4 as VisualRegressionArtifact, V as VitestRunner, a5 as VitestRunnerConfig, a6 as VitestRunnerConstructor, a7 as VitestRunnerImportSource } from './tasks.d-Bh0IjN67.js';
1
+ export { A as AfterAllListener, i as AfterEachListener, j as AroundAllListener, k as AroundEachListener, B as BeforeAllListener, l as BeforeEachListener, C as CancelReason, m as FailureScreenshotArtifact, c as File, F as FileSpecification, n as Fixture, o as FixtureFn, p as FixtureOptions, q as Fixtures, I as ImportDuration, r as InferFixturesTypes, O as OnTestFailedHandler, s as OnTestFinishedHandler, R as Retry, t as RunMode, u as RuntimeContext, v as SequenceHooks, w as SequenceSetupFiles, x as SerializableRetry, S as Suite, g as SuiteAPI, h as SuiteCollector, y as SuiteFactory, b as SuiteHooks, z as SuiteOptions, e as Task, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, d as TaskUpdateEvent, a as Test, f as TestAPI, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, T as TestArtifact, W as TestArtifactBase, X as TestArtifactLocation, Y as TestArtifactRegistry, Z as TestAttachment, _ as TestContext, $ as TestFunction, a0 as TestOptions, a1 as TestTagDefinition, a2 as TestTags, a3 as Use, a4 as VisualRegressionArtifact, V as VitestRunner, a5 as VitestRunnerConfig, a6 as VitestRunnerConstructor, a7 as VitestRunnerImportSource } from './tasks.d-DEYaIMIu.js';
2
2
  import '@vitest/utils';
3
3
  import '@vitest/utils/diff';
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as Suite, c as File, e as Task, a1 as TestTagDefinition, a5 as VitestRunnerConfig, a as Test } from './tasks.d-Bh0IjN67.js';
2
- export { ag as ChainableFunction, ah as createChainable } from './tasks.d-Bh0IjN67.js';
1
+ import { S as Suite, c as File, e as Task, a1 as TestTagDefinition, a5 as VitestRunnerConfig, a as Test } from './tasks.d-DEYaIMIu.js';
2
+ export { ag as ChainableFunction, ah as createChainable } from './tasks.d-DEYaIMIu.js';
3
3
  import { ParsedStack, Arrayable } from '@vitest/utils';
4
4
  import '@vitest/utils/diff';
5
5
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/runner",
3
3
  "type": "module",
4
- "version": "4.1.5",
4
+ "version": "4.1.7",
5
5
  "description": "Vitest test runner",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -44,7 +44,7 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "pathe": "^2.0.3",
47
- "@vitest/utils": "4.1.5"
47
+ "@vitest/utils": "4.1.7"
48
48
  },
49
49
  "scripts": {
50
50
  "build": "premove dist && rollup -c",