@vitest/runner 3.0.2 → 3.0.4

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -10
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -47,6 +47,10 @@ function withTimeout(fn, timeout, isHook = false) {
47
47
  (_a = timer.unref) == null ? undefined : _a.call(timer);
48
48
  function resolve(result) {
49
49
  clearTimeout(timer);
50
+ if (now$2() - startTime >= timeout) {
51
+ reject_(new Error(makeTimeoutMsg(isHook, timeout)));
52
+ return;
53
+ }
50
54
  resolve_(result);
51
55
  }
52
56
  function reject(error) {
@@ -56,16 +60,7 @@ function withTimeout(fn, timeout, isHook = false) {
56
60
  try {
57
61
  const result = fn(...args);
58
62
  if (typeof result === "object" && result != null && typeof result.then === "function") {
59
- result.then(
60
- (result2) => {
61
- if (now$2() - startTime >= timeout) {
62
- reject(new Error(makeTimeoutMsg(isHook, timeout)));
63
- } else {
64
- resolve(result2);
65
- }
66
- },
67
- reject
68
- );
63
+ result.then(resolve, reject);
69
64
  } else {
70
65
  resolve(result);
71
66
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/runner",
3
3
  "type": "module",
4
- "version": "3.0.2",
4
+ "version": "3.0.4",
5
5
  "description": "Vitest test runner",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -38,8 +38,8 @@
38
38
  "dist"
39
39
  ],
40
40
  "dependencies": {
41
- "pathe": "^2.0.1",
42
- "@vitest/utils": "3.0.2"
41
+ "pathe": "^2.0.2",
42
+ "@vitest/utils": "3.0.4"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "rimraf dist && rollup -c",