vitest 2.0.2 → 2.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.
- package/LICENSE.md +21 -0
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunks/{integrations-globals.CzYWb38r.js → integrations-globals.nDMtdOcn.js} +3 -3
- package/dist/chunks/{runtime-runBaseTests.DJ9UidQ0.js → runtime-runBaseTests.Dq_sJZq9.js} +20 -10
- package/dist/cli.js +2 -2
- package/dist/config.cjs +0 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +0 -1
- package/dist/coverage.d.ts +1 -1
- package/dist/coverage.js +9 -5
- package/dist/environments.d.ts +1 -1
- package/dist/execute.d.ts +4 -4
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/node.d.ts +2 -2
- package/dist/node.js +5 -5
- package/dist/{reporters-BECoY4-b.d.ts → reporters-B7ebVMkT.d.ts} +3 -3
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +3 -3
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +2 -2
- package/dist/{suite-BWgaIsVn.d.ts → suite-CRLAhsm0.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/vendor/{base.pB8aBRcE.js → base.Csk7BT3h.js} +2 -2
- package/dist/vendor/{base.CTYV4Gnz.js → base.DRHPZCCj.js} +4 -3
- package/dist/vendor/{cac.C2zVnLp0.js → cac.DFtWvZc2.js} +7 -7
- package/dist/vendor/{cli-api.FtQZKvQk.js → cli-api.CTkP2Ier.js} +256 -70
- package/dist/vendor/{execute.Dx503nGn.js → execute.jzOWtys_.js} +2 -2
- package/dist/vendor/{index.CROIsoiT.js → index.CVqMv71L.js} +1 -1
- package/dist/vendor/{index.BCwvoAaf.js → index.CuuL9y4g.js} +3 -5
- package/dist/vendor/{index.Hqvcg1pf.js → index.DI9daj1Q.js} +1 -1
- package/dist/vendor/{inspector.hPQncR7V.js → inspector.-FCQUzqR.js} +2 -1
- package/dist/vendor/{setup-common.yHaxjRhz.js → setup-common.symvFZPh.js} +1 -1
- package/dist/vendor/{utils.DyTe1Nxn.js → utils.BySfPUwy.js} +1 -1
- package/dist/vendor/{vi.DXACdGTu.js → vi.Elqer9-7.js} +1 -1
- package/dist/vendor/{vm.D1T5Rxan.js → vm.img-AOox.js} +1 -1
- package/dist/worker.js +2 -2
- package/dist/workers/forks.js +3 -3
- package/dist/workers/runVmTests.js +20 -10
- package/dist/workers/threads.js +3 -3
- package/dist/workers/vmForks.js +3 -3
- package/dist/workers/vmThreads.js +3 -3
- package/dist/workers.d.ts +1 -1
- package/dist/workers.js +5 -5
- package/package.json +14 -14
|
@@ -17,14 +17,14 @@ import require$$0$3 from 'fs';
|
|
|
17
17
|
import { ViteNodeRunner } from 'vite-node/client';
|
|
18
18
|
import { SnapshotManager } from '@vitest/snapshot/manager';
|
|
19
19
|
import { ViteNodeServer } from 'vite-node/server';
|
|
20
|
-
import { v as version$1 } from './cac.
|
|
20
|
+
import { v as version$1 } from './cac.DFtWvZc2.js';
|
|
21
21
|
import { hasFailed, createFileTask, getTasks, getTests, getNames } from '@vitest/runner/utils';
|
|
22
|
-
import { n as noop$1, b as isPrimitive, c as groupBy, A as AggregateErrorPonyfill, a as slash$1, t as toArray, d as deepMerge, e as nanoid, w as wildcardPatternToRegExp, f as stdout } from './base.
|
|
22
|
+
import { n as noop$1, b as isPrimitive, c as groupBy, A as AggregateErrorPonyfill, a as slash$1, t as toArray, d as deepMerge, e as nanoid, w as wildcardPatternToRegExp, f as stdout } from './base.DRHPZCCj.js';
|
|
23
23
|
import { createDefer, toArray as toArray$1, notNullish } from '@vitest/utils';
|
|
24
24
|
import { b as isWindows } from './env.2ltrQNq0.js';
|
|
25
25
|
import { rootDir, distDir } from '../path.js';
|
|
26
26
|
import { c as createBirpc } from './index.BpSiYbpB.js';
|
|
27
|
-
import { s as stringify, p as parse$3, w as wrapSerializableConfig, f as Typechecker, R as ReportersMap, d as BenchmarkReportsMap, g as RandomSequencer, e as BaseSequencer, h as findNodeAround, i as generateCodeFrame, j as highlightCode, L as Logger, k as BlobReporter, r as readBlobs } from './index.
|
|
27
|
+
import { s as stringify, p as parse$3, w as wrapSerializableConfig, f as Typechecker, R as ReportersMap, d as BenchmarkReportsMap, g as RandomSequencer, e as BaseSequencer, h as findNodeAround, i as generateCodeFrame, j as highlightCode, L as Logger, k as BlobReporter, r as readBlobs } from './index.CuuL9y4g.js';
|
|
28
28
|
import require$$0$5 from 'zlib';
|
|
29
29
|
import require$$0$6 from 'buffer';
|
|
30
30
|
import require$$1 from 'crypto';
|
|
@@ -54,7 +54,7 @@ import MagicString from 'magic-string';
|
|
|
54
54
|
import { esmWalker } from '@vitest/utils/ast';
|
|
55
55
|
import { a as removeUndefinedValues } from './index.BJmtb_7W.js';
|
|
56
56
|
import readline from 'node:readline';
|
|
57
|
-
import { s as stripAnsi } from './utils.
|
|
57
|
+
import { s as stripAnsi } from './utils.BySfPUwy.js';
|
|
58
58
|
|
|
59
59
|
async function getModuleGraph(ctx, projectName, id, browser = false) {
|
|
60
60
|
const graph = {};
|
|
@@ -3358,10 +3358,16 @@ var fg = /*@__PURE__*/getDefaultExportFromCjs(out);
|
|
|
3358
3358
|
|
|
3359
3359
|
var bufferUtil$1 = {exports: {}};
|
|
3360
3360
|
|
|
3361
|
+
const BINARY_TYPES$2 = ['nodebuffer', 'arraybuffer', 'fragments'];
|
|
3362
|
+
const hasBlob$1 = typeof Blob !== 'undefined';
|
|
3363
|
+
|
|
3364
|
+
if (hasBlob$1) BINARY_TYPES$2.push('blob');
|
|
3365
|
+
|
|
3361
3366
|
var constants = {
|
|
3362
|
-
BINARY_TYPES:
|
|
3367
|
+
BINARY_TYPES: BINARY_TYPES$2,
|
|
3363
3368
|
EMPTY_BUFFER: Buffer.alloc(0),
|
|
3364
3369
|
GUID: '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',
|
|
3370
|
+
hasBlob: hasBlob$1,
|
|
3365
3371
|
kForOnEventAttribute: Symbol('kIsForOnEventAttribute'),
|
|
3366
3372
|
kListener: Symbol('kListener'),
|
|
3367
3373
|
kStatusCode: Symbol('status-code'),
|
|
@@ -4077,6 +4083,8 @@ var isValidUTF8_1;
|
|
|
4077
4083
|
|
|
4078
4084
|
const { isUtf8 } = require$$0$6;
|
|
4079
4085
|
|
|
4086
|
+
const { hasBlob } = constants;
|
|
4087
|
+
|
|
4080
4088
|
//
|
|
4081
4089
|
// Allowed token characters:
|
|
4082
4090
|
//
|
|
@@ -4182,7 +4190,27 @@ function _isValidUTF8(buf) {
|
|
|
4182
4190
|
return true;
|
|
4183
4191
|
}
|
|
4184
4192
|
|
|
4193
|
+
/**
|
|
4194
|
+
* Determines whether a value is a `Blob`.
|
|
4195
|
+
*
|
|
4196
|
+
* @param {*} value The value to be tested
|
|
4197
|
+
* @return {Boolean} `true` if `value` is a `Blob`, else `false`
|
|
4198
|
+
* @private
|
|
4199
|
+
*/
|
|
4200
|
+
function isBlob$2(value) {
|
|
4201
|
+
return (
|
|
4202
|
+
hasBlob &&
|
|
4203
|
+
typeof value === 'object' &&
|
|
4204
|
+
typeof value.arrayBuffer === 'function' &&
|
|
4205
|
+
typeof value.type === 'string' &&
|
|
4206
|
+
typeof value.stream === 'function' &&
|
|
4207
|
+
(value[Symbol.toStringTag] === 'Blob' ||
|
|
4208
|
+
value[Symbol.toStringTag] === 'File')
|
|
4209
|
+
);
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4185
4212
|
validation.exports = {
|
|
4213
|
+
isBlob: isBlob$2,
|
|
4186
4214
|
isValidStatusCode: isValidStatusCode$2,
|
|
4187
4215
|
isValidUTF8: _isValidUTF8,
|
|
4188
4216
|
tokenChars: tokenChars$2
|
|
@@ -4213,7 +4241,7 @@ const {
|
|
|
4213
4241
|
BINARY_TYPES: BINARY_TYPES$1,
|
|
4214
4242
|
EMPTY_BUFFER: EMPTY_BUFFER$2,
|
|
4215
4243
|
kStatusCode: kStatusCode$1,
|
|
4216
|
-
kWebSocket: kWebSocket$
|
|
4244
|
+
kWebSocket: kWebSocket$3
|
|
4217
4245
|
} = constants;
|
|
4218
4246
|
const { concat, toArrayBuffer, unmask } = bufferUtilExports;
|
|
4219
4247
|
const { isValidStatusCode: isValidStatusCode$1, isValidUTF8 } = validationExports;
|
|
@@ -4262,7 +4290,7 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
4262
4290
|
this._isServer = !!options.isServer;
|
|
4263
4291
|
this._maxPayload = options.maxPayload | 0;
|
|
4264
4292
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
4265
|
-
this[kWebSocket$
|
|
4293
|
+
this[kWebSocket$3] = undefined;
|
|
4266
4294
|
|
|
4267
4295
|
this._bufferedBytes = 0;
|
|
4268
4296
|
this._buffers = [];
|
|
@@ -4765,6 +4793,8 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
4765
4793
|
data = concat(fragments, messageLength);
|
|
4766
4794
|
} else if (this._binaryType === 'arraybuffer') {
|
|
4767
4795
|
data = toArrayBuffer(concat(fragments, messageLength));
|
|
4796
|
+
} else if (this._binaryType === 'blob') {
|
|
4797
|
+
data = new Blob(fragments);
|
|
4768
4798
|
} else {
|
|
4769
4799
|
data = fragments;
|
|
4770
4800
|
}
|
|
@@ -4913,8 +4943,8 @@ var receiver = Receiver$1;
|
|
|
4913
4943
|
const { randomFillSync } = require$$1;
|
|
4914
4944
|
|
|
4915
4945
|
const PerMessageDeflate$2 = permessageDeflate;
|
|
4916
|
-
const { EMPTY_BUFFER: EMPTY_BUFFER$1 } = constants;
|
|
4917
|
-
const { isValidStatusCode } = validationExports;
|
|
4946
|
+
const { EMPTY_BUFFER: EMPTY_BUFFER$1, kWebSocket: kWebSocket$2, NOOP: NOOP$1 } = constants;
|
|
4947
|
+
const { isBlob: isBlob$1, isValidStatusCode } = validationExports;
|
|
4918
4948
|
const { mask: applyMask, toBuffer: toBuffer$1 } = bufferUtilExports;
|
|
4919
4949
|
|
|
4920
4950
|
const kByteLength = Symbol('kByteLength');
|
|
@@ -4923,6 +4953,10 @@ const RANDOM_POOL_SIZE = 8 * 1024;
|
|
|
4923
4953
|
let randomPool;
|
|
4924
4954
|
let randomPoolPointer = RANDOM_POOL_SIZE;
|
|
4925
4955
|
|
|
4956
|
+
const DEFAULT = 0;
|
|
4957
|
+
const DEFLATING = 1;
|
|
4958
|
+
const GET_BLOB_DATA = 2;
|
|
4959
|
+
|
|
4926
4960
|
/**
|
|
4927
4961
|
* HyBi Sender implementation.
|
|
4928
4962
|
*/
|
|
@@ -4949,8 +4983,10 @@ let Sender$1 = class Sender {
|
|
|
4949
4983
|
this._compress = false;
|
|
4950
4984
|
|
|
4951
4985
|
this._bufferedBytes = 0;
|
|
4952
|
-
this._deflating = false;
|
|
4953
4986
|
this._queue = [];
|
|
4987
|
+
this._state = DEFAULT;
|
|
4988
|
+
this.onerror = NOOP$1;
|
|
4989
|
+
this[kWebSocket$2] = undefined;
|
|
4954
4990
|
}
|
|
4955
4991
|
|
|
4956
4992
|
/**
|
|
@@ -5117,7 +5153,7 @@ let Sender$1 = class Sender {
|
|
|
5117
5153
|
rsv1: false
|
|
5118
5154
|
};
|
|
5119
5155
|
|
|
5120
|
-
if (this.
|
|
5156
|
+
if (this._state !== DEFAULT) {
|
|
5121
5157
|
this.enqueue([this.dispatch, buf, false, options, cb]);
|
|
5122
5158
|
} else {
|
|
5123
5159
|
this.sendFrame(Sender.frame(buf, options), cb);
|
|
@@ -5139,6 +5175,9 @@ let Sender$1 = class Sender {
|
|
|
5139
5175
|
if (typeof data === 'string') {
|
|
5140
5176
|
byteLength = Buffer.byteLength(data);
|
|
5141
5177
|
readOnly = false;
|
|
5178
|
+
} else if (isBlob$1(data)) {
|
|
5179
|
+
byteLength = data.size;
|
|
5180
|
+
readOnly = false;
|
|
5142
5181
|
} else {
|
|
5143
5182
|
data = toBuffer$1(data);
|
|
5144
5183
|
byteLength = data.length;
|
|
@@ -5160,7 +5199,13 @@ let Sender$1 = class Sender {
|
|
|
5160
5199
|
rsv1: false
|
|
5161
5200
|
};
|
|
5162
5201
|
|
|
5163
|
-
if (
|
|
5202
|
+
if (isBlob$1(data)) {
|
|
5203
|
+
if (this._state !== DEFAULT) {
|
|
5204
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
5205
|
+
} else {
|
|
5206
|
+
this.getBlobData(data, false, options, cb);
|
|
5207
|
+
}
|
|
5208
|
+
} else if (this._state !== DEFAULT) {
|
|
5164
5209
|
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
5165
5210
|
} else {
|
|
5166
5211
|
this.sendFrame(Sender.frame(data, options), cb);
|
|
@@ -5182,6 +5227,9 @@ let Sender$1 = class Sender {
|
|
|
5182
5227
|
if (typeof data === 'string') {
|
|
5183
5228
|
byteLength = Buffer.byteLength(data);
|
|
5184
5229
|
readOnly = false;
|
|
5230
|
+
} else if (isBlob$1(data)) {
|
|
5231
|
+
byteLength = data.size;
|
|
5232
|
+
readOnly = false;
|
|
5185
5233
|
} else {
|
|
5186
5234
|
data = toBuffer$1(data);
|
|
5187
5235
|
byteLength = data.length;
|
|
@@ -5203,7 +5251,13 @@ let Sender$1 = class Sender {
|
|
|
5203
5251
|
rsv1: false
|
|
5204
5252
|
};
|
|
5205
5253
|
|
|
5206
|
-
if (
|
|
5254
|
+
if (isBlob$1(data)) {
|
|
5255
|
+
if (this._state !== DEFAULT) {
|
|
5256
|
+
this.enqueue([this.getBlobData, data, false, options, cb]);
|
|
5257
|
+
} else {
|
|
5258
|
+
this.getBlobData(data, false, options, cb);
|
|
5259
|
+
}
|
|
5260
|
+
} else if (this._state !== DEFAULT) {
|
|
5207
5261
|
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
5208
5262
|
} else {
|
|
5209
5263
|
this.sendFrame(Sender.frame(data, options), cb);
|
|
@@ -5237,6 +5291,9 @@ let Sender$1 = class Sender {
|
|
|
5237
5291
|
if (typeof data === 'string') {
|
|
5238
5292
|
byteLength = Buffer.byteLength(data);
|
|
5239
5293
|
readOnly = false;
|
|
5294
|
+
} else if (isBlob$1(data)) {
|
|
5295
|
+
byteLength = data.size;
|
|
5296
|
+
readOnly = false;
|
|
5240
5297
|
} else {
|
|
5241
5298
|
data = toBuffer$1(data);
|
|
5242
5299
|
byteLength = data.length;
|
|
@@ -5264,40 +5321,94 @@ let Sender$1 = class Sender {
|
|
|
5264
5321
|
|
|
5265
5322
|
if (options.fin) this._firstFragment = true;
|
|
5266
5323
|
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
};
|
|
5324
|
+
const opts = {
|
|
5325
|
+
[kByteLength]: byteLength,
|
|
5326
|
+
fin: options.fin,
|
|
5327
|
+
generateMask: this._generateMask,
|
|
5328
|
+
mask: options.mask,
|
|
5329
|
+
maskBuffer: this._maskBuffer,
|
|
5330
|
+
opcode,
|
|
5331
|
+
readOnly,
|
|
5332
|
+
rsv1
|
|
5333
|
+
};
|
|
5278
5334
|
|
|
5279
|
-
|
|
5280
|
-
|
|
5335
|
+
if (isBlob$1(data)) {
|
|
5336
|
+
if (this._state !== DEFAULT) {
|
|
5337
|
+
this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
|
|
5281
5338
|
} else {
|
|
5282
|
-
this.
|
|
5339
|
+
this.getBlobData(data, this._compress, opts, cb);
|
|
5283
5340
|
}
|
|
5341
|
+
} else if (this._state !== DEFAULT) {
|
|
5342
|
+
this.enqueue([this.dispatch, data, this._compress, opts, cb]);
|
|
5284
5343
|
} else {
|
|
5285
|
-
this.
|
|
5286
|
-
Sender.frame(data, {
|
|
5287
|
-
[kByteLength]: byteLength,
|
|
5288
|
-
fin: options.fin,
|
|
5289
|
-
generateMask: this._generateMask,
|
|
5290
|
-
mask: options.mask,
|
|
5291
|
-
maskBuffer: this._maskBuffer,
|
|
5292
|
-
opcode,
|
|
5293
|
-
readOnly,
|
|
5294
|
-
rsv1: false
|
|
5295
|
-
}),
|
|
5296
|
-
cb
|
|
5297
|
-
);
|
|
5344
|
+
this.dispatch(data, this._compress, opts, cb);
|
|
5298
5345
|
}
|
|
5299
5346
|
}
|
|
5300
5347
|
|
|
5348
|
+
/**
|
|
5349
|
+
* Gets the contents of a blob as binary data.
|
|
5350
|
+
*
|
|
5351
|
+
* @param {Blob} blob The blob
|
|
5352
|
+
* @param {Boolean} [compress=false] Specifies whether or not to compress
|
|
5353
|
+
* the data
|
|
5354
|
+
* @param {Object} options Options object
|
|
5355
|
+
* @param {Boolean} [options.fin=false] Specifies whether or not to set the
|
|
5356
|
+
* FIN bit
|
|
5357
|
+
* @param {Function} [options.generateMask] The function used to generate the
|
|
5358
|
+
* masking key
|
|
5359
|
+
* @param {Boolean} [options.mask=false] Specifies whether or not to mask
|
|
5360
|
+
* `data`
|
|
5361
|
+
* @param {Buffer} [options.maskBuffer] The buffer used to store the masking
|
|
5362
|
+
* key
|
|
5363
|
+
* @param {Number} options.opcode The opcode
|
|
5364
|
+
* @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
|
|
5365
|
+
* modified
|
|
5366
|
+
* @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
|
|
5367
|
+
* RSV1 bit
|
|
5368
|
+
* @param {Function} [cb] Callback
|
|
5369
|
+
* @private
|
|
5370
|
+
*/
|
|
5371
|
+
getBlobData(blob, compress, options, cb) {
|
|
5372
|
+
this._bufferedBytes += options[kByteLength];
|
|
5373
|
+
this._state = GET_BLOB_DATA;
|
|
5374
|
+
|
|
5375
|
+
blob
|
|
5376
|
+
.arrayBuffer()
|
|
5377
|
+
.then((arrayBuffer) => {
|
|
5378
|
+
if (this._socket.destroyed) {
|
|
5379
|
+
const err = new Error(
|
|
5380
|
+
'The socket was closed while the blob was being read'
|
|
5381
|
+
);
|
|
5382
|
+
|
|
5383
|
+
//
|
|
5384
|
+
// `callCallbacks` is called in the next tick to ensure that errors
|
|
5385
|
+
// that might be thrown in the callbacks behave like errors thrown
|
|
5386
|
+
// outside the promise chain.
|
|
5387
|
+
//
|
|
5388
|
+
process.nextTick(callCallbacks, this, err, cb);
|
|
5389
|
+
return;
|
|
5390
|
+
}
|
|
5391
|
+
|
|
5392
|
+
this._bufferedBytes -= options[kByteLength];
|
|
5393
|
+
const data = toBuffer$1(arrayBuffer);
|
|
5394
|
+
|
|
5395
|
+
if (!compress) {
|
|
5396
|
+
this._state = DEFAULT;
|
|
5397
|
+
this.sendFrame(Sender.frame(data, options), cb);
|
|
5398
|
+
this.dequeue();
|
|
5399
|
+
} else {
|
|
5400
|
+
this.dispatch(data, compress, options, cb);
|
|
5401
|
+
}
|
|
5402
|
+
})
|
|
5403
|
+
.catch((err) => {
|
|
5404
|
+
//
|
|
5405
|
+
// `onError` is called in the next tick for the same reason that
|
|
5406
|
+
// `callCallbacks` above is.
|
|
5407
|
+
//
|
|
5408
|
+
process.nextTick(onError, this, err, cb);
|
|
5409
|
+
});
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5301
5412
|
/**
|
|
5302
5413
|
* Dispatches a message.
|
|
5303
5414
|
*
|
|
@@ -5330,27 +5441,19 @@ let Sender$1 = class Sender {
|
|
|
5330
5441
|
const perMessageDeflate = this._extensions[PerMessageDeflate$2.extensionName];
|
|
5331
5442
|
|
|
5332
5443
|
this._bufferedBytes += options[kByteLength];
|
|
5333
|
-
this.
|
|
5444
|
+
this._state = DEFLATING;
|
|
5334
5445
|
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
5335
5446
|
if (this._socket.destroyed) {
|
|
5336
5447
|
const err = new Error(
|
|
5337
5448
|
'The socket was closed while data was being compressed'
|
|
5338
5449
|
);
|
|
5339
5450
|
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
for (let i = 0; i < this._queue.length; i++) {
|
|
5343
|
-
const params = this._queue[i];
|
|
5344
|
-
const callback = params[params.length - 1];
|
|
5345
|
-
|
|
5346
|
-
if (typeof callback === 'function') callback(err);
|
|
5347
|
-
}
|
|
5348
|
-
|
|
5451
|
+
callCallbacks(this, err, cb);
|
|
5349
5452
|
return;
|
|
5350
5453
|
}
|
|
5351
5454
|
|
|
5352
5455
|
this._bufferedBytes -= options[kByteLength];
|
|
5353
|
-
this.
|
|
5456
|
+
this._state = DEFAULT;
|
|
5354
5457
|
options.readOnly = false;
|
|
5355
5458
|
this.sendFrame(Sender.frame(buf, options), cb);
|
|
5356
5459
|
this.dequeue();
|
|
@@ -5363,7 +5466,7 @@ let Sender$1 = class Sender {
|
|
|
5363
5466
|
* @private
|
|
5364
5467
|
*/
|
|
5365
5468
|
dequeue() {
|
|
5366
|
-
while (
|
|
5469
|
+
while (this._state === DEFAULT && this._queue.length) {
|
|
5367
5470
|
const params = this._queue.shift();
|
|
5368
5471
|
|
|
5369
5472
|
this._bufferedBytes -= params[3][kByteLength];
|
|
@@ -5403,6 +5506,38 @@ let Sender$1 = class Sender {
|
|
|
5403
5506
|
|
|
5404
5507
|
var sender = Sender$1;
|
|
5405
5508
|
|
|
5509
|
+
/**
|
|
5510
|
+
* Calls queued callbacks with an error.
|
|
5511
|
+
*
|
|
5512
|
+
* @param {Sender} sender The `Sender` instance
|
|
5513
|
+
* @param {Error} err The error to call the callbacks with
|
|
5514
|
+
* @param {Function} [cb] The first callback
|
|
5515
|
+
* @private
|
|
5516
|
+
*/
|
|
5517
|
+
function callCallbacks(sender, err, cb) {
|
|
5518
|
+
if (typeof cb === 'function') cb(err);
|
|
5519
|
+
|
|
5520
|
+
for (let i = 0; i < sender._queue.length; i++) {
|
|
5521
|
+
const params = sender._queue[i];
|
|
5522
|
+
const callback = params[params.length - 1];
|
|
5523
|
+
|
|
5524
|
+
if (typeof callback === 'function') callback(err);
|
|
5525
|
+
}
|
|
5526
|
+
}
|
|
5527
|
+
|
|
5528
|
+
/**
|
|
5529
|
+
* Handles a `Sender` error.
|
|
5530
|
+
*
|
|
5531
|
+
* @param {Sender} sender The `Sender` instance
|
|
5532
|
+
* @param {Error} err The error
|
|
5533
|
+
* @param {Function} [cb] The first pending callback
|
|
5534
|
+
* @private
|
|
5535
|
+
*/
|
|
5536
|
+
function onError(sender, err, cb) {
|
|
5537
|
+
callCallbacks(sender, err, cb);
|
|
5538
|
+
sender.onerror(err);
|
|
5539
|
+
}
|
|
5540
|
+
|
|
5406
5541
|
const { kForOnEventAttribute: kForOnEventAttribute$1, kListener: kListener$1 } = constants;
|
|
5407
5542
|
|
|
5408
5543
|
const kCode = Symbol('kCode');
|
|
@@ -5909,6 +6044,8 @@ const { URL: URL$1 } = require$$7;
|
|
|
5909
6044
|
const PerMessageDeflate$1 = permessageDeflate;
|
|
5910
6045
|
const Receiver = receiver;
|
|
5911
6046
|
const Sender = sender;
|
|
6047
|
+
const { isBlob } = validationExports;
|
|
6048
|
+
|
|
5912
6049
|
const {
|
|
5913
6050
|
BINARY_TYPES,
|
|
5914
6051
|
EMPTY_BUFFER,
|
|
@@ -5953,6 +6090,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
|
5953
6090
|
this._closeFrameSent = false;
|
|
5954
6091
|
this._closeMessage = EMPTY_BUFFER;
|
|
5955
6092
|
this._closeTimer = null;
|
|
6093
|
+
this._errorEmitted = false;
|
|
5956
6094
|
this._extensions = {};
|
|
5957
6095
|
this._paused = false;
|
|
5958
6096
|
this._protocol = '';
|
|
@@ -5985,9 +6123,8 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
|
5985
6123
|
}
|
|
5986
6124
|
|
|
5987
6125
|
/**
|
|
5988
|
-
*
|
|
5989
|
-
*
|
|
5990
|
-
* type).
|
|
6126
|
+
* For historical reasons, the custom "nodebuffer" type is used by the default
|
|
6127
|
+
* instead of "blob".
|
|
5991
6128
|
*
|
|
5992
6129
|
* @type {String}
|
|
5993
6130
|
*/
|
|
@@ -6108,11 +6245,14 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
|
6108
6245
|
skipUTF8Validation: options.skipUTF8Validation
|
|
6109
6246
|
});
|
|
6110
6247
|
|
|
6111
|
-
|
|
6248
|
+
const sender = new Sender(socket, this._extensions, options.generateMask);
|
|
6249
|
+
|
|
6112
6250
|
this._receiver = receiver;
|
|
6251
|
+
this._sender = sender;
|
|
6113
6252
|
this._socket = socket;
|
|
6114
6253
|
|
|
6115
6254
|
receiver[kWebSocket$1] = this;
|
|
6255
|
+
sender[kWebSocket$1] = this;
|
|
6116
6256
|
socket[kWebSocket$1] = this;
|
|
6117
6257
|
|
|
6118
6258
|
receiver.on('conclude', receiverOnConclude);
|
|
@@ -6122,6 +6262,8 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
|
6122
6262
|
receiver.on('ping', receiverOnPing);
|
|
6123
6263
|
receiver.on('pong', receiverOnPong);
|
|
6124
6264
|
|
|
6265
|
+
sender.onerror = senderOnError;
|
|
6266
|
+
|
|
6125
6267
|
//
|
|
6126
6268
|
// These methods may not be available if `socket` is just a `Duplex`.
|
|
6127
6269
|
//
|
|
@@ -6217,13 +6359,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
|
6217
6359
|
}
|
|
6218
6360
|
});
|
|
6219
6361
|
|
|
6220
|
-
|
|
6221
|
-
// Specify a timeout for the closing handshake to complete.
|
|
6222
|
-
//
|
|
6223
|
-
this._closeTimer = setTimeout(
|
|
6224
|
-
this._socket.destroy.bind(this._socket),
|
|
6225
|
-
closeTimeout
|
|
6226
|
-
);
|
|
6362
|
+
setCloseTimer(this);
|
|
6227
6363
|
}
|
|
6228
6364
|
|
|
6229
6365
|
/**
|
|
@@ -6927,6 +7063,11 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
6927
7063
|
*/
|
|
6928
7064
|
function emitErrorAndClose(websocket, err) {
|
|
6929
7065
|
websocket._readyState = WebSocket$1.CLOSING;
|
|
7066
|
+
//
|
|
7067
|
+
// The following assignment is practically useless and is done only for
|
|
7068
|
+
// consistency.
|
|
7069
|
+
//
|
|
7070
|
+
websocket._errorEmitted = true;
|
|
6930
7071
|
websocket.emit('error', err);
|
|
6931
7072
|
websocket.emitClose();
|
|
6932
7073
|
}
|
|
@@ -7007,7 +7148,7 @@ function abortHandshake$1(websocket, stream, message) {
|
|
|
7007
7148
|
*/
|
|
7008
7149
|
function sendAfterClose(websocket, data, cb) {
|
|
7009
7150
|
if (data) {
|
|
7010
|
-
const length = toBuffer(data).length;
|
|
7151
|
+
const length = isBlob(data) ? data.size : toBuffer(data).length;
|
|
7011
7152
|
|
|
7012
7153
|
//
|
|
7013
7154
|
// The `_bufferedAmount` property is used only when the peer is a client and
|
|
@@ -7083,7 +7224,10 @@ function receiverOnError(err) {
|
|
|
7083
7224
|
websocket.close(err[kStatusCode]);
|
|
7084
7225
|
}
|
|
7085
7226
|
|
|
7086
|
-
websocket.
|
|
7227
|
+
if (!websocket._errorEmitted) {
|
|
7228
|
+
websocket._errorEmitted = true;
|
|
7229
|
+
websocket.emit('error', err);
|
|
7230
|
+
}
|
|
7087
7231
|
}
|
|
7088
7232
|
|
|
7089
7233
|
/**
|
|
@@ -7139,6 +7283,47 @@ function resume(stream) {
|
|
|
7139
7283
|
stream.resume();
|
|
7140
7284
|
}
|
|
7141
7285
|
|
|
7286
|
+
/**
|
|
7287
|
+
* The `Sender` error event handler.
|
|
7288
|
+
*
|
|
7289
|
+
* @param {Error} The error
|
|
7290
|
+
* @private
|
|
7291
|
+
*/
|
|
7292
|
+
function senderOnError(err) {
|
|
7293
|
+
const websocket = this[kWebSocket$1];
|
|
7294
|
+
|
|
7295
|
+
if (websocket.readyState === WebSocket$1.CLOSED) return;
|
|
7296
|
+
if (websocket.readyState === WebSocket$1.OPEN) {
|
|
7297
|
+
websocket._readyState = WebSocket$1.CLOSING;
|
|
7298
|
+
setCloseTimer(websocket);
|
|
7299
|
+
}
|
|
7300
|
+
|
|
7301
|
+
//
|
|
7302
|
+
// `socket.end()` is used instead of `socket.destroy()` to allow the other
|
|
7303
|
+
// peer to finish sending queued data. There is no need to set a timer here
|
|
7304
|
+
// because `CLOSING` means that it is already set or not needed.
|
|
7305
|
+
//
|
|
7306
|
+
this._socket.end();
|
|
7307
|
+
|
|
7308
|
+
if (!websocket._errorEmitted) {
|
|
7309
|
+
websocket._errorEmitted = true;
|
|
7310
|
+
websocket.emit('error', err);
|
|
7311
|
+
}
|
|
7312
|
+
}
|
|
7313
|
+
|
|
7314
|
+
/**
|
|
7315
|
+
* Set a timer to destroy the underlying raw socket of a WebSocket.
|
|
7316
|
+
*
|
|
7317
|
+
* @param {WebSocket} websocket The WebSocket instance
|
|
7318
|
+
* @private
|
|
7319
|
+
*/
|
|
7320
|
+
function setCloseTimer(websocket) {
|
|
7321
|
+
websocket._closeTimer = setTimeout(
|
|
7322
|
+
websocket._socket.destroy.bind(websocket._socket),
|
|
7323
|
+
closeTimeout
|
|
7324
|
+
);
|
|
7325
|
+
}
|
|
7326
|
+
|
|
7142
7327
|
/**
|
|
7143
7328
|
* The listener of the socket `'close'` event.
|
|
7144
7329
|
*
|
|
@@ -8048,9 +8233,11 @@ async function groupFilesByEnv(files) {
|
|
|
8048
8233
|
project.config.testTransformMode,
|
|
8049
8234
|
file
|
|
8050
8235
|
);
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8236
|
+
let envOptionsJson = (_b = code.match(/@(?:vitest|jest)-environment-options\s+(.+)/)) == null ? void 0 : _b[1];
|
|
8237
|
+
if (envOptionsJson == null ? void 0 : envOptionsJson.endsWith("*/")) {
|
|
8238
|
+
envOptionsJson = envOptionsJson.slice(0, -2);
|
|
8239
|
+
}
|
|
8240
|
+
const envOptions = JSON.parse(envOptionsJson || "null");
|
|
8054
8241
|
const envKey = env === "happy-dom" ? "happyDOM" : env;
|
|
8055
8242
|
const environment = {
|
|
8056
8243
|
name: env,
|
|
@@ -11607,7 +11794,6 @@ const coverageConfigDefaults = {
|
|
|
11607
11794
|
".mjs",
|
|
11608
11795
|
".ts",
|
|
11609
11796
|
".mts",
|
|
11610
|
-
".cts",
|
|
11611
11797
|
".tsx",
|
|
11612
11798
|
".jsx",
|
|
11613
11799
|
".vue",
|
|
@@ -14187,7 +14373,7 @@ class VitestPackageInstaller {
|
|
|
14187
14373
|
try {
|
|
14188
14374
|
targetRequire.resolve(dependency, { paths: [root, __dirname] });
|
|
14189
14375
|
return true;
|
|
14190
|
-
} catch
|
|
14376
|
+
} catch {
|
|
14191
14377
|
}
|
|
14192
14378
|
}
|
|
14193
14379
|
if (/* @__PURE__ */ isPackageExists(dependency, { paths: [root, __dirname] })) {
|
|
@@ -7,7 +7,7 @@ import { resolve, isAbsolute, dirname, join, basename, extname, normalize, relat
|
|
|
7
7
|
import { processError } from '@vitest/utils/error';
|
|
8
8
|
import { distDir } from '../path.js';
|
|
9
9
|
import { highlight, getType } from '@vitest/utils';
|
|
10
|
-
import { g as getAllMockableProperties } from './base.
|
|
10
|
+
import { g as getAllMockableProperties } from './base.DRHPZCCj.js';
|
|
11
11
|
|
|
12
12
|
const { existsSync, readdirSync } = fs;
|
|
13
13
|
const spyModulePath = resolve(distDir, "spy.js");
|
|
@@ -271,7 +271,7 @@ If you need to partially mock a module, you can use "importOriginal" helper insi
|
|
|
271
271
|
if (!isModule && descriptor.get) {
|
|
272
272
|
try {
|
|
273
273
|
Object.defineProperty(newContainer, property, descriptor);
|
|
274
|
-
} catch
|
|
274
|
+
} catch {
|
|
275
275
|
}
|
|
276
276
|
continue;
|
|
277
277
|
}
|
|
@@ -4,7 +4,7 @@ import { distDir } from '../path.js';
|
|
|
4
4
|
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
5
5
|
import { r as rpc } from './rpc.BGx7q_k2.js';
|
|
6
6
|
import { t as takeCoverageInsideWorker } from './coverage.BhYSDdTT.js';
|
|
7
|
-
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.
|
|
7
|
+
import { l as loadDiffConfig, a as loadSnapshotSerializers } from './setup-common.symvFZPh.js';
|
|
8
8
|
|
|
9
9
|
function setupChaiConfig(config) {
|
|
10
10
|
Object.assign(chai.config, config);
|
|
@@ -3,15 +3,15 @@ import c from 'tinyrainbow';
|
|
|
3
3
|
import * as pathe from 'pathe';
|
|
4
4
|
import { basename, dirname, resolve, join, relative, extname, normalize } from 'pathe';
|
|
5
5
|
import { g as getTestName, h as hasFailedSnapshot, a as getFullName } from './tasks.DhVtQBtW.js';
|
|
6
|
-
import {
|
|
6
|
+
import { notNullish, highlight, shuffle, inspect, positionToOffset, lineSplitRE } from '@vitest/utils';
|
|
7
7
|
import { i as isNode, a as isDeno } from './env.2ltrQNq0.js';
|
|
8
|
-
import { g as getStateSymbol, f as formatProjectName, t as taskFail, F as F_RIGHT, a as F_POINTER, r as renderSnapshotSummary, b as getStateString, c as formatTimeString, d as countTestErrors, e as divider, s as stripAnsi, h as getCols, i as getHookStateSymbol } from './utils.
|
|
8
|
+
import { g as getStateSymbol, f as formatProjectName, t as taskFail, F as F_RIGHT, a as F_POINTER, r as renderSnapshotSummary, b as getStateString, c as formatTimeString, d as countTestErrors, e as divider, s as stripAnsi, h as getCols, i as getHookStateSymbol } from './utils.BySfPUwy.js';
|
|
9
9
|
import { generateHash, calculateSuiteHash, someTasksAreOnly, interpretTaskModes, getTasks, getTests, hasFailed, getSuites } from '@vitest/runner/utils';
|
|
10
10
|
import { performance } from 'node:perf_hooks';
|
|
11
11
|
import { TraceMap, generatedPositionFor, parseStacktrace, parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
12
12
|
import { r as relativePath } from './index.BJmtb_7W.js';
|
|
13
13
|
import { UNKNOWN_TEST_ID } from '../chunks/runtime-console.C2L2zykk.js';
|
|
14
|
-
import { t as toArray, b as isPrimitive } from './base.
|
|
14
|
+
import { t as toArray, b as isPrimitive } from './base.DRHPZCCj.js';
|
|
15
15
|
import { isCI } from 'std-env';
|
|
16
16
|
import nodeos__default, { hostname } from 'node:os';
|
|
17
17
|
import { Writable } from 'node:stream';
|
|
@@ -1173,7 +1173,6 @@ class BaseReporter {
|
|
|
1173
1173
|
];
|
|
1174
1174
|
this.ctx.logger.logUpdate(BADGE_PADDING + LAST_RUN_TEXTS[0]);
|
|
1175
1175
|
this._lastRunTimeout = 0;
|
|
1176
|
-
const { setInterval } = getSafeTimers();
|
|
1177
1176
|
this._lastRunTimer = setInterval(() => {
|
|
1178
1177
|
this._lastRunTimeout += 1;
|
|
1179
1178
|
if (this._lastRunTimeout >= LAST_RUN_TEXTS.length) {
|
|
@@ -1187,7 +1186,6 @@ class BaseReporter {
|
|
|
1187
1186
|
}
|
|
1188
1187
|
}
|
|
1189
1188
|
resetLastRunLog() {
|
|
1190
|
-
const { clearInterval } = getSafeTimers();
|
|
1191
1189
|
clearInterval(this._lastRunTimer);
|
|
1192
1190
|
this._lastRunTimer = void 0;
|
|
1193
1191
|
this.ctx.logger.logUpdate.clear();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterAll, afterEach, beforeAll, beforeEach, describe, it, onTestFailed, onTestFinished, suite, test } from '@vitest/runner';
|
|
2
2
|
import { b as bench } from './benchmark.B6pblCp2.js';
|
|
3
3
|
import { i as isFirstRun, a as runOnce } from './run-once.Db8Hgq9X.js';
|
|
4
|
-
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.
|
|
4
|
+
import { c as createExpect, a as globalExpect, v as vi, b as vitest } from './vi.Elqer9-7.js';
|
|
5
5
|
import { g as getWorkerState } from './global.7bFbnyXl.js';
|
|
6
6
|
import * as chai from 'chai';
|
|
7
7
|
import { assert, should } from 'chai';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
2
3
|
|
|
3
4
|
const __require = createRequire(import.meta.url);
|
|
4
5
|
let inspector;
|
|
@@ -23,7 +24,7 @@ function setupInspect(ctx) {
|
|
|
23
24
|
session.post("Debugger.enable");
|
|
24
25
|
session.post("Debugger.setBreakpointByUrl", {
|
|
25
26
|
lineNumber: 0,
|
|
26
|
-
url:
|
|
27
|
+
url: pathToFileURL(firstTestFile)
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
}
|
|
@@ -13,7 +13,7 @@ async function setupCommonEnv(config) {
|
|
|
13
13
|
globalSetup = true;
|
|
14
14
|
setSafeTimers();
|
|
15
15
|
if (config.globals) {
|
|
16
|
-
(await import('../chunks/integrations-globals.
|
|
16
|
+
(await import('../chunks/integrations-globals.nDMtdOcn.js')).registerApiGlobally();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
function setupDefines(defines) {
|