vitest 0.12.8 → 0.13.0

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 (23) hide show
  1. package/dist/{chunk-api-setup.9ccd19b5.js → chunk-api-setup.554e8dcb.js} +107 -51
  2. package/dist/{chunk-constants.3570739f.js → chunk-constants.d60bb984.js} +1 -1
  3. package/dist/{chunk-defaults.7d81a6ca.js → chunk-defaults.c11f632f.js} +1 -1
  4. package/dist/{chunk-install-pkg.fd8d1022.js → chunk-install-pkg.8a034cf6.js} +1 -1
  5. package/dist/{chunk-integrations-globals.23cc66c3.js → chunk-integrations-globals.f7036c09.js} +7 -7
  6. package/dist/{chunk-runtime-chain.5021a6b6.js → chunk-runtime-chain.db87de48.js} +21 -10
  7. package/dist/{chunk-runtime-mocker.d26f8110.js → chunk-runtime-mocker.8436db18.js} +3 -3
  8. package/dist/chunk-runtime-rpc.6e6614a9.js +15 -0
  9. package/dist/{chunk-utils-global.2fab7e5c.js → chunk-utils-global.b9f8edf8.js} +34 -2
  10. package/dist/{chunk-utils-timers.da6ac0a6.js → chunk-utils-source-map.ded50c88.js} +14 -11
  11. package/dist/{chunk-vite-node-externalize.fc385bba.js → chunk-vite-node-externalize.0094db73.js} +8740 -8741
  12. package/dist/{chunk-vite-node-utils.46e2a803.js → chunk-vite-node-utils.6856b365.js} +1 -1
  13. package/dist/cli.js +16 -16
  14. package/dist/entry.js +6 -6
  15. package/dist/index.d.ts +61 -10
  16. package/dist/index.js +4 -4
  17. package/dist/node.d.ts +56 -0
  18. package/dist/node.js +20 -20
  19. package/dist/{vendor-entry.ca05c118.js → vendor-entry.6072d652.js} +11 -11
  20. package/dist/{vendor-index.6c69a0a8.js → vendor-index.42fcc02c.js} +407 -407
  21. package/dist/worker.js +5 -5
  22. package/package.json +37 -37
  23. package/dist/chunk-runtime-rpc.47bae3f9.js +0 -7
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-utils.46e2a803.js';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.6856b365.js';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,11 +9,11 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import url from 'url';
12
- import { A as API_PATH } from './chunk-constants.3570739f.js';
13
- import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.da6ac0a6.js';
12
+ import { A as API_PATH } from './chunk-constants.d60bb984.js';
13
+ import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.ded50c88.js';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-utils-global.2fab7e5c.js';
16
+ import './chunk-utils-global.b9f8edf8.js';
17
17
  import 'tty';
18
18
  import 'local-pkg';
19
19
  import 'path';
@@ -3268,6 +3268,7 @@ function initAsClient(websocket, address, protocols, options) {
3268
3268
 
3269
3269
  if (opts.followRedirects) {
3270
3270
  if (websocket._redirects === 0) {
3271
+ websocket._originalSecure = isSecure;
3271
3272
  websocket._originalHost = parsedUrl.host;
3272
3273
 
3273
3274
  const headers = options && options.headers;
@@ -3283,18 +3284,21 @@ function initAsClient(websocket, address, protocols, options) {
3283
3284
  options.headers[key.toLowerCase()] = value;
3284
3285
  }
3285
3286
  }
3286
- } else if (
3287
- websocket.listenerCount('redirect') === 0 &&
3288
- parsedUrl.host !== websocket._originalHost
3289
- ) {
3290
- //
3291
- // Match curl 7.77.0 behavior and drop the following headers. These
3292
- // headers are also dropped when following a redirect to a subdomain.
3293
- //
3294
- delete opts.headers.authorization;
3295
- delete opts.headers.cookie;
3296
- delete opts.headers.host;
3297
- opts.auth = undefined;
3287
+ } else if (websocket.listenerCount('redirect') === 0) {
3288
+ const isSameHost = parsedUrl.host === websocket._originalHost;
3289
+
3290
+ if (!isSameHost || (websocket._originalSecure && !isSecure)) {
3291
+ //
3292
+ // Match curl 7.77.0 behavior and drop the following headers. These
3293
+ // headers are also dropped when following a redirect to a subdomain.
3294
+ //
3295
+ delete opts.headers.authorization;
3296
+ delete opts.headers.cookie;
3297
+
3298
+ if (!isSameHost) delete opts.headers.host;
3299
+
3300
+ opts.auth = undefined;
3301
+ }
3298
3302
  }
3299
3303
 
3300
3304
  //
@@ -3386,6 +3390,11 @@ function initAsClient(websocket, address, protocols, options) {
3386
3390
 
3387
3391
  req = websocket._req = null;
3388
3392
 
3393
+ if (res.headers.upgrade.toLowerCase() !== 'websocket') {
3394
+ abortHandshake$1(websocket, socket, 'Invalid Upgrade header');
3395
+ return;
3396
+ }
3397
+
3389
3398
  const digest = createHash$1('sha1')
3390
3399
  .update(key + GUID$1)
3391
3400
  .digest('base64');
@@ -4071,21 +4080,36 @@ class WebSocketServer extends EventEmitter {
4071
4080
  handleUpgrade(req, socket, head, cb) {
4072
4081
  socket.on('error', socketOnError);
4073
4082
 
4074
- const key =
4075
- req.headers['sec-websocket-key'] !== undefined
4076
- ? req.headers['sec-websocket-key']
4077
- : false;
4083
+ const key = req.headers['sec-websocket-key'];
4078
4084
  const version = +req.headers['sec-websocket-version'];
4079
4085
 
4080
- if (
4081
- req.method !== 'GET' ||
4082
- req.headers.upgrade.toLowerCase() !== 'websocket' ||
4083
- !key ||
4084
- !keyRegex.test(key) ||
4085
- (version !== 8 && version !== 13) ||
4086
- !this.shouldHandle(req)
4087
- ) {
4088
- return abortHandshake(socket, 400);
4086
+ if (req.method !== 'GET') {
4087
+ const message = 'Invalid HTTP method';
4088
+ abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
4089
+ return;
4090
+ }
4091
+
4092
+ if (req.headers.upgrade.toLowerCase() !== 'websocket') {
4093
+ const message = 'Invalid Upgrade header';
4094
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
4095
+ return;
4096
+ }
4097
+
4098
+ if (!key || !keyRegex.test(key)) {
4099
+ const message = 'Missing or invalid Sec-WebSocket-Key header';
4100
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
4101
+ return;
4102
+ }
4103
+
4104
+ if (version !== 8 && version !== 13) {
4105
+ const message = 'Missing or invalid Sec-WebSocket-Version header';
4106
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
4107
+ return;
4108
+ }
4109
+
4110
+ if (!this.shouldHandle(req)) {
4111
+ abortHandshake(socket, 400);
4112
+ return;
4089
4113
  }
4090
4114
 
4091
4115
  const secWebSocketProtocol = req.headers['sec-websocket-protocol'];
@@ -4095,7 +4119,9 @@ class WebSocketServer extends EventEmitter {
4095
4119
  try {
4096
4120
  protocols = subprotocol.parse(secWebSocketProtocol);
4097
4121
  } catch (err) {
4098
- return abortHandshake(socket, 400);
4122
+ const message = 'Invalid Sec-WebSocket-Protocol header';
4123
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
4124
+ return;
4099
4125
  }
4100
4126
  }
4101
4127
 
@@ -4120,7 +4146,10 @@ class WebSocketServer extends EventEmitter {
4120
4146
  extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
4121
4147
  }
4122
4148
  } catch (err) {
4123
- return abortHandshake(socket, 400);
4149
+ const message =
4150
+ 'Invalid or unacceptable Sec-WebSocket-Extensions header';
4151
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
4152
+ return;
4124
4153
  }
4125
4154
  }
4126
4155
 
@@ -4287,7 +4316,7 @@ function emitClose(server) {
4287
4316
  }
4288
4317
 
4289
4318
  /**
4290
- * Handle premature socket errors.
4319
+ * Handle socket errors.
4291
4320
  *
4292
4321
  * @private
4293
4322
  */
@@ -4305,27 +4334,54 @@ function socketOnError() {
4305
4334
  * @private
4306
4335
  */
4307
4336
  function abortHandshake(socket, code, message, headers) {
4308
- if (socket.writable) {
4309
- message = message || http.STATUS_CODES[code];
4310
- headers = {
4311
- Connection: 'close',
4312
- 'Content-Type': 'text/html',
4313
- 'Content-Length': Buffer.byteLength(message),
4314
- ...headers
4315
- };
4337
+ //
4338
+ // The socket is writable unless the user destroyed or ended it before calling
4339
+ // `server.handleUpgrade()` or in the `verifyClient` function, which is a user
4340
+ // error. Handling this does not make much sense as the worst that can happen
4341
+ // is that some of the data written by the user might be discarded due to the
4342
+ // call to `socket.end()` below, which triggers an `'error'` event that in
4343
+ // turn causes the socket to be destroyed.
4344
+ //
4345
+ message = message || http.STATUS_CODES[code];
4346
+ headers = {
4347
+ Connection: 'close',
4348
+ 'Content-Type': 'text/html',
4349
+ 'Content-Length': Buffer.byteLength(message),
4350
+ ...headers
4351
+ };
4316
4352
 
4317
- socket.write(
4318
- `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` +
4319
- Object.keys(headers)
4320
- .map((h) => `${h}: ${headers[h]}`)
4321
- .join('\r\n') +
4322
- '\r\n\r\n' +
4323
- message
4324
- );
4325
- }
4353
+ socket.once('finish', socket.destroy);
4326
4354
 
4327
- socket.removeListener('error', socketOnError);
4328
- socket.destroy();
4355
+ socket.end(
4356
+ `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` +
4357
+ Object.keys(headers)
4358
+ .map((h) => `${h}: ${headers[h]}`)
4359
+ .join('\r\n') +
4360
+ '\r\n\r\n' +
4361
+ message
4362
+ );
4363
+ }
4364
+
4365
+ /**
4366
+ * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least
4367
+ * one listener for it, otherwise call `abortHandshake()`.
4368
+ *
4369
+ * @param {WebSocketServer} server The WebSocket server
4370
+ * @param {http.IncomingMessage} req The request object
4371
+ * @param {(net.Socket|tls.Socket)} socket The socket of the upgrade request
4372
+ * @param {Number} code The HTTP response status code
4373
+ * @param {String} message The HTTP response body
4374
+ * @private
4375
+ */
4376
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message) {
4377
+ if (server.listenerCount('wsClientError')) {
4378
+ const err = new Error(message);
4379
+ Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
4380
+
4381
+ server.emit('wsClientError', err, socket, req);
4382
+ } else {
4383
+ abortHandshake(socket, code, message);
4384
+ }
4329
4385
  }
4330
4386
 
4331
4387
  function setup(ctx) {
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { h as resolve } from './chunk-utils-global.2fab7e5c.js';
2
+ import { l as resolve } from './chunk-utils-global.b9f8edf8.js';
3
3
 
4
4
  const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
5
5
  const defaultPort = 51204;
@@ -1,7 +1,7 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import { pathToFileURL } from 'url';
4
- import { t as toArray, h as resolve } from './chunk-utils-global.2fab7e5c.js';
4
+ import { t as toArray, l as resolve } from './chunk-utils-global.b9f8edf8.js';
5
5
 
6
6
  const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
7
7
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
@@ -2,7 +2,7 @@ import path$2 from 'path';
2
2
  import fs$2 from 'fs';
3
3
  import require$$0 from 'util';
4
4
  import childProcess$1 from 'child_process';
5
- import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.6c69a0a8.js';
5
+ import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.42fcc02c.js';
6
6
  import require$$0$1 from 'os';
7
7
  import './vendor-_commonjsHelpers.addc3445.js';
8
8
  import 'assert';
@@ -1,20 +1,20 @@
1
- import { g as globalApis } from './chunk-constants.3570739f.js';
2
- import { i as index } from './vendor-entry.ca05c118.js';
1
+ import { g as globalApis } from './chunk-constants.d60bb984.js';
2
+ import { i as index } from './vendor-entry.6072d652.js';
3
3
  import 'url';
4
- import './chunk-utils-global.2fab7e5c.js';
4
+ import './chunk-utils-global.b9f8edf8.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
8
  import 'fs';
9
- import './chunk-runtime-chain.5021a6b6.js';
9
+ import './chunk-runtime-chain.db87de48.js';
10
10
  import 'chai';
11
11
  import './vendor-_commonjsHelpers.addc3445.js';
12
- import './chunk-runtime-rpc.47bae3f9.js';
13
- import './chunk-utils-timers.da6ac0a6.js';
12
+ import './chunk-runtime-rpc.6e6614a9.js';
13
+ import './chunk-utils-source-map.ded50c88.js';
14
14
  import './chunk-integrations-spy.bee66426.js';
15
15
  import 'tinyspy';
16
16
  import 'util';
17
- import './chunk-defaults.7d81a6ca.js';
17
+ import './chunk-defaults.c11f632f.js';
18
18
  import 'module';
19
19
 
20
20
  function registerApiGlobally() {
@@ -1,9 +1,9 @@
1
1
  import chai$1, { expect as expect$1, AssertionError, util } from 'chai';
2
2
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
3
- import { r as rpc } from './chunk-runtime-rpc.47bae3f9.js';
4
- import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.2fab7e5c.js';
3
+ import { r as rpc } from './chunk-runtime-rpc.6e6614a9.js';
4
+ import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, e as safeSetTimeout, f as safeClearTimeout, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.b9f8edf8.js';
5
5
  import fs, { promises } from 'fs';
6
- import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.da6ac0a6.js';
6
+ import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.ded50c88.js';
7
7
  import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.bee66426.js';
8
8
  import require$$0, { format } from 'util';
9
9
 
@@ -329,7 +329,7 @@ const hasPropertyInObject = (object, key) => {
329
329
  return false;
330
330
  return Object.prototype.hasOwnProperty.call(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key);
331
331
  };
332
- const isObjectWithKeys = (a) => isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
332
+ const isObjectWithKeys = (a) => isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date);
333
333
  const subsetEquality = (object, subset) => {
334
334
  const subsetEqualityWithContext = (seenReferences = /* @__PURE__ */ new WeakMap()) => (object2, subset2) => {
335
335
  if (!isObjectWithKeys(subset2))
@@ -1223,7 +1223,7 @@ const JestChaiExpect = (chai, utils) => {
1223
1223
  } else if (received === -Infinity && expected === -Infinity) {
1224
1224
  pass = true;
1225
1225
  } else {
1226
- expectedDiff = Math.pow(10, -precision) / 2;
1226
+ expectedDiff = 10 ** -precision / 2;
1227
1227
  receivedDiff = Math.abs(expected - received);
1228
1228
  pass = receivedDiff < expectedDiff;
1229
1229
  }
@@ -1406,8 +1406,8 @@ Number of calls: ${picocolors.exports.bold(spy.mock.calls.length)}
1406
1406
  const nthCallReturn = equals(callResult, value);
1407
1407
  this.assert(nthCallReturn, `expected ${ordinalCall} "${spyName}" call to return #{exp}`, `expected ${ordinalCall} "${spyName}" call to not return #{exp}`, value, callResult);
1408
1408
  });
1409
- def("toSatisfy", function() {
1410
- return this.be.satisfy;
1409
+ def("toSatisfy", function(matcher, message) {
1410
+ return this.be.satisfy(matcher, message);
1411
1411
  });
1412
1412
  utils.addProperty(chai.Assertion.prototype, "resolves", function __VITEST_RESOLVES__() {
1413
1413
  utils.flag(this, "promise", "resolves");
@@ -1717,7 +1717,8 @@ const getMatcherState = (assertion) => {
1717
1717
  utils: jestUtils,
1718
1718
  promise,
1719
1719
  equals,
1720
- suppressedErrors: []
1720
+ suppressedErrors: [],
1721
+ snapshotState: getSnapshotClient().snapshotState
1721
1722
  });
1722
1723
  return {
1723
1724
  state: matcherState,
@@ -1838,8 +1839,8 @@ function withTimeout(fn, timeout = getDefaultTestTimeout(), isHook = false) {
1838
1839
  return (...args) => {
1839
1840
  return Promise.race([fn(...args), new Promise((resolve, reject) => {
1840
1841
  var _a;
1841
- const timer = setTimeout(() => {
1842
- clearTimeout(timer);
1842
+ const timer = safeSetTimeout(() => {
1843
+ safeClearTimeout(timer);
1843
1844
  reject(new Error(makeTimeoutMsg(isHook, timeout)));
1844
1845
  }, timeout);
1845
1846
  (_a = timer.unref) == null ? void 0 : _a.call(timer);
@@ -4850,6 +4851,16 @@ class VitestUtils {
4850
4851
  resetModules();
4851
4852
  return this;
4852
4853
  }
4854
+ async dynamicImportSettled() {
4855
+ const state = getWorkerState();
4856
+ const promises = [];
4857
+ for (const mod of state.moduleCache.values()) {
4858
+ if (mod.promise)
4859
+ promises.push(mod.promise);
4860
+ }
4861
+ await Promise.allSettled(promises);
4862
+ await new Promise((resolve) => safeSetTimeout(resolve, 1)).then(() => Promise.resolve());
4863
+ }
4853
4864
  }
4854
4865
  const vitest = new VitestUtils();
4855
4866
  const vi = vitest;
@@ -1,8 +1,8 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.46e2a803.js';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.6856b365.js';
2
2
  import { normalizePath } from 'vite';
3
- import { a as getWorkerState, D as isWindows, E as mergeSlashes, d as dirname, h as resolve, f as basename, F as getType, G as getAllProperties, s as slash } from './chunk-utils-global.2fab7e5c.js';
3
+ import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, l as resolve, k as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.b9f8edf8.js';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { d as distDir } from './chunk-constants.3570739f.js';
5
+ import { d as distDir } from './chunk-constants.d60bb984.js';
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -0,0 +1,15 @@
1
+ import { a as getWorkerState, w as withSafeTimers } from './chunk-utils-global.b9f8edf8.js';
2
+
3
+ const rpc = () => {
4
+ const { rpc: rpc2 } = getWorkerState();
5
+ return new Proxy(rpc2, {
6
+ get(target, p, handler) {
7
+ const sendCall = Reflect.get(target, p, handler);
8
+ const safeSendCall = (...args) => withSafeTimers(() => sendCall(...args));
9
+ safeSendCall.asEvent = sendCall.asEvent;
10
+ return safeSendCall;
11
+ }
12
+ });
13
+ };
14
+
15
+ export { rpc as r };
@@ -385,6 +385,32 @@ function getNames(task) {
385
385
  return names;
386
386
  }
387
387
 
388
+ const {
389
+ setTimeout: safeSetTimeout,
390
+ setInterval: safeSetInterval,
391
+ clearInterval: safeClearInterval,
392
+ clearTimeout: safeClearTimeout
393
+ } = globalThis;
394
+ function withSafeTimers(fn) {
395
+ const currentSetTimeout = globalThis.setTimeout;
396
+ const currentSetInterval = globalThis.setInterval;
397
+ const currentClearInterval = globalThis.clearInterval;
398
+ const currentClearTimeout = globalThis.clearTimeout;
399
+ try {
400
+ globalThis.setTimeout = safeSetTimeout;
401
+ globalThis.setInterval = safeSetInterval;
402
+ globalThis.clearInterval = safeClearInterval;
403
+ globalThis.clearTimeout = safeClearTimeout;
404
+ const result = fn();
405
+ return result;
406
+ } finally {
407
+ globalThis.setTimeout = currentSetTimeout;
408
+ globalThis.setInterval = currentSetInterval;
409
+ globalThis.clearInterval = currentClearInterval;
410
+ globalThis.clearTimeout = currentClearTimeout;
411
+ }
412
+ }
413
+
388
414
  const isNode = typeof process !== "undefined" && typeof process.platform !== "undefined";
389
415
  const isWindows = isNode && process.platform === "win32";
390
416
  function partitionSuiteChildren(suite) {
@@ -433,7 +459,7 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
433
459
  message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
434
460
  });
435
461
  if (install) {
436
- await (await import('./chunk-install-pkg.fd8d1022.js')).installPackage(dependency, { dev: true });
462
+ await (await import('./chunk-install-pkg.8a034cf6.js')).installPackage(dependency, { dev: true });
437
463
  process.stderr.write(picocolors.exports.yellow(`
438
464
  Package ${dependency} installed, re-run the command to start.
439
465
  `));
@@ -470,5 +496,11 @@ function getCallLastIndex(code) {
470
496
  }
471
497
  return null;
472
498
  }
499
+ class AggregateErrorPonyfill extends Error {
500
+ constructor(errors, message = "") {
501
+ super(message);
502
+ this.errors = [...errors];
503
+ }
504
+ }
473
505
 
474
- export { ensurePackageInstalled as A, stdout as B, extname as C, isWindows as D, mergeSlashes as E, getType as F, getAllProperties as G, clone as H, partitionSuiteChildren as I, hasTests as J, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, notNullish as e, basename as f, getCallLastIndex as g, resolve as h, isObject as i, join as j, isAbsolute as k, relative as l, isNode as m, noop as n, getTests as o, picocolors as p, getFullName as q, resetModules as r, slash as s, toArray as t, hasFailed as u, hasFailedSnapshot as v, getSuites as w, normalize as x, deepMerge as y, toNamespacedPath as z };
506
+ export { AggregateErrorPonyfill as A, safeSetInterval as B, safeClearInterval as C, normalize as D, deepMerge as E, toNamespacedPath as F, ensurePackageInstalled as G, stdout as H, extname as I, isWindows as J, mergeSlashes as K, getType as L, getAllProperties as M, clone as N, partitionSuiteChildren as O, hasTests as P, getWorkerState as a, getNames as b, assertTypes as c, dirname as d, safeSetTimeout as e, safeClearTimeout as f, getCallLastIndex as g, notNullish as h, isObject as i, join as j, basename as k, resolve as l, isAbsolute as m, noop as n, relative as o, picocolors as p, isNode as q, resetModules as r, slash as s, toArray as t, getTests as u, getFullName as v, withSafeTimers as w, hasFailed as x, hasFailedSnapshot as y, getSuites as z };
@@ -1,9 +1,4 @@
1
- import { s as slash, e as notNullish, p as picocolors } from './chunk-utils-global.2fab7e5c.js';
2
-
3
- const setTimeout$1 = globalThis.setTimeout;
4
- const setInterval = globalThis.setInterval;
5
- const clearInterval = globalThis.clearInterval;
6
- const clearTimeout = globalThis.clearTimeout;
1
+ import { s as slash, h as notNullish, p as picocolors } from './chunk-utils-global.b9f8edf8.js';
7
2
 
8
3
  var build = {};
9
4
 
@@ -5765,6 +5760,11 @@ Diff.prototype = {
5765
5760
  oldLen = oldString.length;
5766
5761
  var editLength = 1;
5767
5762
  var maxEditLength = newLen + oldLen;
5763
+
5764
+ if (options.maxEditLength) {
5765
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
5766
+ }
5767
+
5768
5768
  var bestPath = [{
5769
5769
  newPos: -1,
5770
5770
  components: []
@@ -5829,15 +5829,13 @@ Diff.prototype = {
5829
5829
  editLength++;
5830
5830
  } // Performs the length of edit iteration. Is a bit fugly as this has to support the
5831
5831
  // sync and async mode which is never fun. Loops over execEditLength until a value
5832
- // is produced.
5832
+ // is produced, or until the edit length exceeds options.maxEditLength (if given),
5833
+ // in which case it will return undefined.
5833
5834
 
5834
5835
 
5835
5836
  if (callback) {
5836
5837
  (function exec() {
5837
5838
  setTimeout(function () {
5838
- // This should not happen, but we want to be safe.
5839
-
5840
- /* istanbul ignore next */
5841
5839
  if (editLength > maxEditLength) {
5842
5840
  return callback();
5843
5841
  }
@@ -6236,6 +6234,11 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
6236
6234
  }
6237
6235
 
6238
6236
  var diff = diffLines(oldStr, newStr, options);
6237
+
6238
+ if (!diff) {
6239
+ return;
6240
+ }
6241
+
6239
6242
  diff.push({
6240
6243
  value: '',
6241
6244
  lines: []
@@ -7425,4 +7428,4 @@ var matcherUtils = /*#__PURE__*/Object.freeze({
7425
7428
  diff: diff
7426
7429
  });
7427
7430
 
7428
- export { posToNumber as a, parseStacktrace as b, setTimeout$1 as c, clearTimeout as d, stripAnsi as e, format_1 as f, getOriginalPos as g, stringWidth as h, ansiStyles as i, sliceAnsi as j, setInterval as k, lineSplitRE as l, matcherUtils as m, numberToPos as n, clearInterval as o, plugins_1 as p, cliTruncate as q, interpretSourcePos as r, stringify as s, unifiedDiff as u };
7431
+ export { posToNumber as a, parseStacktrace as b, stripAnsi as c, stringWidth as d, ansiStyles as e, format_1 as f, getOriginalPos as g, sliceAnsi as h, cliTruncate as i, interpretSourcePos as j, lineSplitRE as l, matcherUtils as m, numberToPos as n, plugins_1 as p, stringify as s, unifiedDiff as u };