@vitest/runner 4.0.0-beta.5 → 4.0.0-beta.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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021-Present Vitest Team
3
+ Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1057,7 +1057,7 @@ function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions
1057
1057
  return collector;
1058
1058
  }
1059
1059
  function withAwaitAsyncAssertions(fn, task) {
1060
- return async (...args) => {
1060
+ return (async (...args) => {
1061
1061
  const fnResult = await fn(...args);
1062
1062
  // some async expect will be added to this array, in case user forget to await them
1063
1063
  if (task.promises) {
@@ -1068,7 +1068,7 @@ function withAwaitAsyncAssertions(fn, task) {
1068
1068
  }
1069
1069
  }
1070
1070
  return fnResult;
1071
- };
1071
+ });
1072
1072
  }
1073
1073
  function createSuite() {
1074
1074
  function suiteFn(name, factoryOrOptions, optionsOrFactory) {
@@ -1863,7 +1863,7 @@ function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) {
1863
1863
  }
1864
1864
  const { setTimeout, clearTimeout } = getSafeTimers();
1865
1865
  // this function name is used to filter error in test/cli/test/fails.test.ts
1866
- return function runWithTimeout(...args) {
1866
+ return (function runWithTimeout(...args) {
1867
1867
  const startTime = now();
1868
1868
  const runner = getRunner();
1869
1869
  runner._currentTaskStartTime = startTime;
@@ -1916,7 +1916,7 @@ catch (error) {
1916
1916
  reject(error);
1917
1917
  }
1918
1918
  });
1919
- };
1919
+ });
1920
1920
  }
1921
1921
  const abortControllers = new WeakMap();
1922
1922
  function abortIfTimeout([context], error) {
@@ -1978,7 +1978,7 @@ function createTestContext(test, runner) {
1978
1978
  test.annotations.push(resolvedAnnotation);
1979
1979
  return resolvedAnnotation;
1980
1980
  }
1981
- context.annotate = (message, type, attachment) => {
1981
+ context.annotate = ((message, type, attachment) => {
1982
1982
  if (test.result && test.result.state !== "run") {
1983
1983
  throw new Error(`Cannot annotate tests outside of the test run. The test "${test.name}" finished running with the "${test.result.state}" state already.`);
1984
1984
  }
@@ -1996,7 +1996,7 @@ function createTestContext(test, runner) {
1996
1996
  } else {
1997
1997
  return recordAsyncAnnotation(test, annotate(message, location, type, attachment));
1998
1998
  }
1999
- };
1999
+ });
2000
2000
  context.onTestFailed = (handler, timeout) => {
2001
2001
  test.onFailed || (test.onFailed = []);
2002
2002
  test.onFailed.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error)));
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AfterAllListener, b as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, e as TaskHook, O as OnTestFailedHandler, f as OnTestFinishedHandler, a as Test, S as Suite, g as SuiteHooks, F as File, h as TaskUpdateEvent, T as Task, i as TestAPI, j as SuiteAPI, k as SuiteCollector } from './tasks.d-B1vSIWO6.js';
2
- export { l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, I as ImportDuration, q as InferFixturesTypes, R as RunMode, r as RuntimeContext, s as SequenceHooks, t as SequenceSetupFiles, u as SuiteFactory, v as TaskBase, w as TaskCustomOptions, x as TaskEventPack, y as TaskMeta, z as TaskPopulated, D as TaskResult, E as TaskResultPack, G as TaskState, J as TestAnnotation, K as TestAnnotationLocation, L as TestAttachment, M as TestContext, N as TestFunction, P as TestOptions, U as Use } from './tasks.d-B1vSIWO6.js';
1
+ import { A as AfterAllListener, b as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, e as TaskHook, O as OnTestFailedHandler, f as OnTestFinishedHandler, a as Test, S as Suite, g as SuiteHooks, F as File, h as TaskUpdateEvent, T as Task, i as TestAPI, j as SuiteAPI, k as SuiteCollector } from './tasks.d-Bsp8b7Fx.js';
2
+ export { l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, I as ImportDuration, q as InferFixturesTypes, R as RunMode, r as RuntimeContext, s as SequenceHooks, t as SequenceSetupFiles, u as SuiteFactory, v as TaskBase, w as TaskCustomOptions, x as TaskEventPack, y as TaskMeta, z as TaskPopulated, D as TaskResult, E as TaskResultPack, G as TaskState, J as TestAnnotation, K as TestAnnotationLocation, L as TestAttachment, M as TestContext, N as TestFunction, P as TestOptions, U as Use } from './tasks.d-Bsp8b7Fx.js';
3
3
  import { Awaitable } from '@vitest/utils';
4
4
  import { FileSpecification, VitestRunner } from './types.js';
5
5
  export { CancelReason, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource } from './types.js';
@@ -95,6 +95,12 @@ interface TaskBase {
95
95
  line: number;
96
96
  column: number;
97
97
  };
98
+ /**
99
+ * If the test was collected by parsing the file AST, and the name
100
+ * is not a static string, this property will be set to `true`.
101
+ * @experimental
102
+ */
103
+ dynamic?: boolean;
98
104
  }
99
105
  interface TaskPopulated extends TaskBase {
100
106
  /**
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DiffOptions } from '@vitest/utils/diff';
2
- import { F as File, a as Test, S as Suite, E as TaskResultPack, x as TaskEventPack, J as TestAnnotation, M as TestContext, I as ImportDuration, s as SequenceHooks, t as SequenceSetupFiles } from './tasks.d-B1vSIWO6.js';
3
- export { A as AfterAllListener, b as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, q as InferFixturesTypes, O as OnTestFailedHandler, f as OnTestFinishedHandler, R as RunMode, r as RuntimeContext, j as SuiteAPI, k as SuiteCollector, u as SuiteFactory, g as SuiteHooks, T as Task, v as TaskBase, w as TaskCustomOptions, e as TaskHook, y as TaskMeta, z as TaskPopulated, D as TaskResult, G as TaskState, h as TaskUpdateEvent, i as TestAPI, K as TestAnnotationLocation, L as TestAttachment, N as TestFunction, P as TestOptions, U as Use } from './tasks.d-B1vSIWO6.js';
2
+ import { F as File, a as Test, S as Suite, E as TaskResultPack, x as TaskEventPack, J as TestAnnotation, M as TestContext, I as ImportDuration, s as SequenceHooks, t as SequenceSetupFiles } from './tasks.d-Bsp8b7Fx.js';
3
+ export { A as AfterAllListener, b as AfterEachListener, B as BeforeAllListener, d as BeforeEachListener, l as Fixture, m as FixtureFn, n as FixtureOptions, o as Fixtures, H as HookCleanupCallback, p as HookListener, q as InferFixturesTypes, O as OnTestFailedHandler, f as OnTestFinishedHandler, R as RunMode, r as RuntimeContext, j as SuiteAPI, k as SuiteCollector, u as SuiteFactory, g as SuiteHooks, T as Task, v as TaskBase, w as TaskCustomOptions, e as TaskHook, y as TaskMeta, z as TaskPopulated, D as TaskResult, G as TaskState, h as TaskUpdateEvent, i as TestAPI, K as TestAnnotationLocation, L as TestAttachment, N as TestFunction, P as TestOptions, U as Use } from './tasks.d-Bsp8b7Fx.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.d-B1vSIWO6.js';
2
- export { C as ChainableFunction, c as createChainable } from './tasks.d-B1vSIWO6.js';
1
+ import { S as Suite, F as File, T as Task, a as Test } from './tasks.d-Bsp8b7Fx.js';
2
+ export { C as ChainableFunction, c as createChainable } from './tasks.d-Bsp8b7Fx.js';
3
3
  import { ParsedStack, 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": "4.0.0-beta.5",
4
+ "version": "4.0.0-beta.7",
5
5
  "description": "Vitest test runner",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -40,7 +40,7 @@
40
40
  "dependencies": {
41
41
  "pathe": "^2.0.3",
42
42
  "strip-literal": "^3.0.0",
43
- "@vitest/utils": "4.0.0-beta.5"
43
+ "@vitest/utils": "4.0.0-beta.7"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "rimraf dist && rollup -c",