vitest 1.0.0-beta.4 → 1.0.0-beta.5
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 +1 -513
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +4 -4
- package/dist/child.js +13 -17
- package/dist/{chunk-api-setup.6d19ab38.js → chunks/api-setup.jHV5vgr2.js} +97 -39
- package/dist/chunks/install-pkg.ORGzQeqb.js +457 -0
- package/dist/chunks/integrations-globals.-pds_Gug.js +29 -0
- package/dist/{chunk-node-git.6c12e560.js → chunks/node-git.Hw101KjS.js} +1 -18
- package/dist/{chunk-runtime-console.f3263f87.js → chunks/runtime-console.iCAG0Yz3.js} +1 -1
- package/dist/cli-wrapper.js +2 -18
- package/dist/cli.js +18 -23
- package/dist/config.cjs +1 -1
- package/dist/config.d.ts +4 -6
- package/dist/config.js +1 -1
- package/dist/coverage.d.ts +25 -15
- package/dist/coverage.js +118 -49
- package/dist/entry-vm.js +13 -13
- package/dist/entry.js +14 -14
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +1 -1
- package/dist/execute.js +3 -3
- package/dist/index.d.ts +166 -38
- package/dist/index.js +10 -10
- package/dist/node.d.ts +5 -5
- package/dist/node.js +17 -22
- package/dist/{vendor-paths.84fc7a99.js → paths.js} +1 -1
- package/dist/{reporters-50c2bd49.d.ts → reporters-ANEBTnOh.d.ts} +324 -361
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +7 -8
- package/dist/runners.d.ts +1 -1
- package/dist/runners.js +8 -8
- package/dist/{suite-ad69b7cd.d.ts → suite-C1OmA61l.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +3 -3
- package/dist/{vendor-benchmark.b6befc50.js → vendor/benchmark.WVm6DARl.js} +1 -1
- package/dist/{vendor-execute.157302d6.js → vendor/execute.aMjV5C9u.js} +2 -4
- package/dist/{vendor-index.72df742e.js → vendor/index.Npc-eff0.js} +4 -4
- package/dist/{vendor-index.2b92937b.js → vendor/index.XU72Rmy8.js} +1 -1
- package/dist/{vendor-index.57925a34.js → vendor/index.h0j9y5vy.js} +5 -5
- package/dist/vendor/index.xL8XjTLv.js +3962 -0
- package/dist/vendor/loader.CU0NY2Is.js +39 -0
- package/dist/{vendor-node.65461b16.js → vendor/node.c-kzGvOB.js} +1874 -5960
- package/dist/{vendor-reporters.d24d80a4.js → vendor/reporters.1xKxm8im.js} +424 -374
- package/dist/{vendor-rpc.171f65fb.js → vendor/rpc.Bl-ysZIr.js} +1 -1
- package/dist/{vendor-run-once.fb836747.js → vendor/run-once.X3E7xx3F.js} +1 -1
- package/dist/{vendor-vi.3baa7c4a.js → vendor/vi.voNYQWB_.js} +4 -4
- package/dist/vm.js +13 -18
- package/dist/worker.js +13 -18
- package/index.cjs +5 -0
- package/package.json +49 -53
- package/dist/chunk-install-pkg.e1d6323e.js +0 -1740
- package/dist/chunk-integrations-globals.2b099e04.js +0 -29
- package/dist/vendor-index.8efe7746.js +0 -2236
- package/dist/vendor-loader.9c966f23.js +0 -2089
- /package/dist/{vendor-_commonjsHelpers.7d1333e8.js → vendor/_commonjsHelpers.jjO7Zipk.js} +0 -0
- /package/dist/{vendor-base.9c08bbd0.js → vendor/base._79unx2z.js} +0 -0
- /package/dist/{vendor-constants.538d9b49.js → vendor/constants.WSvnD_fn.js} +0 -0
- /package/dist/{vendor-coverage.78040316.js → vendor/coverage.v6aD8iAh.js} +0 -0
- /package/dist/{vendor-date.6e993429.js → vendor/date.W90-E5kF.js} +0 -0
- /package/dist/{vendor-environments.dcc4a34e.js → vendor/environments.hpEVJZPC.js} +0 -0
- /package/dist/{vendor-global.c3664e75.js → vendor/global.L7JRz1qU.js} +0 -0
- /package/dist/{vendor-index.1ca68bd5.js → vendor/index.cAUulNDf.js} +0 -0
- /package/dist/{vendor-inspector.209edf5a.js → vendor/inspector.lFAeuaAt.js} +0 -0
- /package/dist/{vendor-tasks.f9d75aed.js → vendor/tasks.IknbGB2n.js} +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { existsSync, promises } from 'node:fs';
|
|
2
2
|
import { dirname } from 'pathe';
|
|
3
|
-
import { c as createBirpc } from '
|
|
3
|
+
import { c as createBirpc } from '../vendor/index.cAUulNDf.js';
|
|
4
4
|
import require$$0$2 from 'stream';
|
|
5
5
|
import require$$0 from 'zlib';
|
|
6
6
|
import require$$0$1 from 'buffer';
|
|
7
|
-
import require$$
|
|
8
|
-
import require$$4 from 'tls';
|
|
9
|
-
import require$$5 from 'crypto';
|
|
7
|
+
import require$$1 from 'crypto';
|
|
10
8
|
import require$$2 from 'events';
|
|
11
|
-
import require$$1 from 'https';
|
|
9
|
+
import require$$1$1 from 'https';
|
|
12
10
|
import require$$2$1 from 'http';
|
|
11
|
+
import require$$3 from 'net';
|
|
12
|
+
import require$$4 from 'tls';
|
|
13
13
|
import require$$7 from 'url';
|
|
14
|
-
import { g as getDefaultExportFromCjs } from '
|
|
15
|
-
import { A as API_PATH } from '
|
|
16
|
-
import '
|
|
14
|
+
import { g as getDefaultExportFromCjs } from '../vendor/_commonjsHelpers.jjO7Zipk.js';
|
|
15
|
+
import { A as API_PATH } from '../vendor/constants.WSvnD_fn.js';
|
|
16
|
+
import '../vendor/index.XU72Rmy8.js';
|
|
17
17
|
import '@vitest/utils';
|
|
18
18
|
import { parseErrorStacktrace } from '@vitest/utils/source-map';
|
|
19
|
-
import { i as isPrimitive } from '
|
|
19
|
+
import { i as isPrimitive } from '../vendor/base._79unx2z.js';
|
|
20
20
|
import 'std-env';
|
|
21
21
|
import '@vitest/runner/utils';
|
|
22
|
-
import '
|
|
22
|
+
import '../vendor/global.L7JRz1qU.js';
|
|
23
23
|
|
|
24
24
|
async function getModuleGraph(ctx, id) {
|
|
25
25
|
const graph = {};
|
|
@@ -1010,12 +1010,21 @@ const { concat, toArrayBuffer, unmask } = bufferUtilExports;
|
|
|
1010
1010
|
const { isValidStatusCode: isValidStatusCode$1, isValidUTF8 } = validationExports;
|
|
1011
1011
|
|
|
1012
1012
|
const FastBuffer = Buffer[Symbol.species];
|
|
1013
|
+
const promise = Promise.resolve();
|
|
1014
|
+
|
|
1015
|
+
//
|
|
1016
|
+
// `queueMicrotask()` is not available in Node.js < 11.
|
|
1017
|
+
//
|
|
1018
|
+
const queueTask =
|
|
1019
|
+
typeof queueMicrotask === 'function' ? queueMicrotask : queueMicrotaskShim;
|
|
1020
|
+
|
|
1013
1021
|
const GET_INFO = 0;
|
|
1014
1022
|
const GET_PAYLOAD_LENGTH_16 = 1;
|
|
1015
1023
|
const GET_PAYLOAD_LENGTH_64 = 2;
|
|
1016
1024
|
const GET_MASK = 3;
|
|
1017
1025
|
const GET_DATA = 4;
|
|
1018
1026
|
const INFLATING = 5;
|
|
1027
|
+
const WAIT_MICROTASK = 6;
|
|
1019
1028
|
|
|
1020
1029
|
/**
|
|
1021
1030
|
* HyBi Receiver implementation.
|
|
@@ -1154,9 +1163,19 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1154
1163
|
case GET_DATA:
|
|
1155
1164
|
err = this.getData(cb);
|
|
1156
1165
|
break;
|
|
1166
|
+
case INFLATING:
|
|
1167
|
+
this._loop = false;
|
|
1168
|
+
return;
|
|
1157
1169
|
default:
|
|
1158
|
-
//
|
|
1170
|
+
//
|
|
1171
|
+
// `WAIT_MICROTASK`.
|
|
1172
|
+
//
|
|
1159
1173
|
this._loop = false;
|
|
1174
|
+
|
|
1175
|
+
queueTask(() => {
|
|
1176
|
+
this._state = GET_INFO;
|
|
1177
|
+
this.startLoop(cb);
|
|
1178
|
+
});
|
|
1160
1179
|
return;
|
|
1161
1180
|
}
|
|
1162
1181
|
} while (this._loop);
|
|
@@ -1539,7 +1558,7 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1539
1558
|
}
|
|
1540
1559
|
}
|
|
1541
1560
|
|
|
1542
|
-
this._state =
|
|
1561
|
+
this._state = WAIT_MICROTASK;
|
|
1543
1562
|
}
|
|
1544
1563
|
|
|
1545
1564
|
/**
|
|
@@ -1556,6 +1575,8 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1556
1575
|
if (data.length === 0) {
|
|
1557
1576
|
this.emit('conclude', 1005, EMPTY_BUFFER$2);
|
|
1558
1577
|
this.end();
|
|
1578
|
+
|
|
1579
|
+
this._state = GET_INFO;
|
|
1559
1580
|
} else {
|
|
1560
1581
|
const code = data.readUInt16BE(0);
|
|
1561
1582
|
|
|
@@ -1587,14 +1608,16 @@ let Receiver$1 = class Receiver extends Writable {
|
|
|
1587
1608
|
|
|
1588
1609
|
this.emit('conclude', code, buf);
|
|
1589
1610
|
this.end();
|
|
1611
|
+
|
|
1612
|
+
this._state = GET_INFO;
|
|
1590
1613
|
}
|
|
1591
1614
|
} else if (this._opcode === 0x09) {
|
|
1592
1615
|
this.emit('ping', data);
|
|
1616
|
+
this._state = WAIT_MICROTASK;
|
|
1593
1617
|
} else {
|
|
1594
1618
|
this.emit('pong', data);
|
|
1619
|
+
this._state = WAIT_MICROTASK;
|
|
1595
1620
|
}
|
|
1596
|
-
|
|
1597
|
-
this._state = GET_INFO;
|
|
1598
1621
|
}
|
|
1599
1622
|
};
|
|
1600
1623
|
|
|
@@ -1623,8 +1646,37 @@ function error(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
|
1623
1646
|
return err;
|
|
1624
1647
|
}
|
|
1625
1648
|
|
|
1626
|
-
|
|
1627
|
-
|
|
1649
|
+
/**
|
|
1650
|
+
* A shim for `queueMicrotask()`.
|
|
1651
|
+
*
|
|
1652
|
+
* @param {Function} cb Callback
|
|
1653
|
+
*/
|
|
1654
|
+
function queueMicrotaskShim(cb) {
|
|
1655
|
+
promise.then(cb).catch(throwErrorNextTick);
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* Throws an error.
|
|
1660
|
+
*
|
|
1661
|
+
* @param {Error} err The error to throw
|
|
1662
|
+
* @private
|
|
1663
|
+
*/
|
|
1664
|
+
function throwError(err) {
|
|
1665
|
+
throw err;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* Throws an error in the next tick.
|
|
1670
|
+
*
|
|
1671
|
+
* @param {Error} err The error to throw
|
|
1672
|
+
* @private
|
|
1673
|
+
*/
|
|
1674
|
+
function throwErrorNextTick(err) {
|
|
1675
|
+
process.nextTick(throwError, err);
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex" }] */
|
|
1679
|
+
const { randomFillSync } = require$$1;
|
|
1628
1680
|
|
|
1629
1681
|
const PerMessageDeflate$2 = permessageDeflate;
|
|
1630
1682
|
const { EMPTY_BUFFER: EMPTY_BUFFER$1 } = constants;
|
|
@@ -1641,7 +1693,7 @@ let Sender$1 = class Sender {
|
|
|
1641
1693
|
/**
|
|
1642
1694
|
* Creates a Sender instance.
|
|
1643
1695
|
*
|
|
1644
|
-
* @param {
|
|
1696
|
+
* @param {Duplex} socket The connection socket
|
|
1645
1697
|
* @param {Object} [extensions] An object containing the negotiated extensions
|
|
1646
1698
|
* @param {Function} [generateMask] The function used to generate the masking
|
|
1647
1699
|
* key
|
|
@@ -2590,14 +2642,14 @@ function format$1(extensions) {
|
|
|
2590
2642
|
|
|
2591
2643
|
var extension$1 = { format: format$1, parse: parse$2 };
|
|
2592
2644
|
|
|
2593
|
-
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Readable$" }] */
|
|
2645
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex|Readable$" }] */
|
|
2594
2646
|
|
|
2595
2647
|
const EventEmitter$1 = require$$2;
|
|
2596
|
-
const https = require$$1;
|
|
2648
|
+
const https = require$$1$1;
|
|
2597
2649
|
const http$1 = require$$2$1;
|
|
2598
2650
|
const net = require$$3;
|
|
2599
2651
|
const tls = require$$4;
|
|
2600
|
-
const { randomBytes, createHash: createHash$1 } = require$$
|
|
2652
|
+
const { randomBytes, createHash: createHash$1 } = require$$1;
|
|
2601
2653
|
const { URL: URL$1 } = require$$7;
|
|
2602
2654
|
|
|
2603
2655
|
const PerMessageDeflate$1 = permessageDeflate;
|
|
@@ -2778,8 +2830,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
|
2778
2830
|
/**
|
|
2779
2831
|
* Set up the socket and the internal resources.
|
|
2780
2832
|
*
|
|
2781
|
-
* @param {
|
|
2782
|
-
* server and client
|
|
2833
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
2783
2834
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
2784
2835
|
* @param {Object} options Options object
|
|
2785
2836
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
@@ -2812,8 +2863,11 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
|
|
|
2812
2863
|
receiver.on('ping', receiverOnPing);
|
|
2813
2864
|
receiver.on('pong', receiverOnPong);
|
|
2814
2865
|
|
|
2815
|
-
|
|
2816
|
-
socket
|
|
2866
|
+
//
|
|
2867
|
+
// These methods may not be available if `socket` is just a `Duplex`.
|
|
2868
|
+
//
|
|
2869
|
+
if (socket.setTimeout) socket.setTimeout(0);
|
|
2870
|
+
if (socket.setNoDelay) socket.setNoDelay();
|
|
2817
2871
|
|
|
2818
2872
|
if (head.length > 0) socket.unshift(head);
|
|
2819
2873
|
|
|
@@ -3256,24 +3310,30 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
3256
3310
|
|
|
3257
3311
|
if (address instanceof URL$1) {
|
|
3258
3312
|
parsedUrl = address;
|
|
3259
|
-
websocket._url = address.href;
|
|
3260
3313
|
} else {
|
|
3261
3314
|
try {
|
|
3262
3315
|
parsedUrl = new URL$1(address);
|
|
3263
3316
|
} catch (e) {
|
|
3264
3317
|
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
3265
3318
|
}
|
|
3319
|
+
}
|
|
3266
3320
|
|
|
3267
|
-
|
|
3321
|
+
if (parsedUrl.protocol === 'http:') {
|
|
3322
|
+
parsedUrl.protocol = 'ws:';
|
|
3323
|
+
} else if (parsedUrl.protocol === 'https:') {
|
|
3324
|
+
parsedUrl.protocol = 'wss:';
|
|
3268
3325
|
}
|
|
3269
3326
|
|
|
3327
|
+
websocket._url = parsedUrl.href;
|
|
3328
|
+
|
|
3270
3329
|
const isSecure = parsedUrl.protocol === 'wss:';
|
|
3271
3330
|
const isIpcUrl = parsedUrl.protocol === 'ws+unix:';
|
|
3272
3331
|
let invalidUrlMessage;
|
|
3273
3332
|
|
|
3274
3333
|
if (parsedUrl.protocol !== 'ws:' && !isSecure && !isIpcUrl) {
|
|
3275
3334
|
invalidUrlMessage =
|
|
3276
|
-
'The URL\'s protocol must be one of "ws:", "wss:",
|
|
3335
|
+
'The URL\'s protocol must be one of "ws:", "wss:", ' +
|
|
3336
|
+
'"http:", "https", or "ws+unix:"';
|
|
3277
3337
|
} else if (isIpcUrl && !parsedUrl.pathname) {
|
|
3278
3338
|
invalidUrlMessage = "The URL's pathname is empty";
|
|
3279
3339
|
} else if (parsedUrl.hash) {
|
|
@@ -3807,7 +3867,7 @@ function resume(stream) {
|
|
|
3807
3867
|
}
|
|
3808
3868
|
|
|
3809
3869
|
/**
|
|
3810
|
-
* The listener of the
|
|
3870
|
+
* The listener of the socket `'close'` event.
|
|
3811
3871
|
*
|
|
3812
3872
|
* @private
|
|
3813
3873
|
*/
|
|
@@ -3858,7 +3918,7 @@ function socketOnClose() {
|
|
|
3858
3918
|
}
|
|
3859
3919
|
|
|
3860
3920
|
/**
|
|
3861
|
-
* The listener of the
|
|
3921
|
+
* The listener of the socket `'data'` event.
|
|
3862
3922
|
*
|
|
3863
3923
|
* @param {Buffer} chunk A chunk of data
|
|
3864
3924
|
* @private
|
|
@@ -3870,7 +3930,7 @@ function socketOnData(chunk) {
|
|
|
3870
3930
|
}
|
|
3871
3931
|
|
|
3872
3932
|
/**
|
|
3873
|
-
* The listener of the
|
|
3933
|
+
* The listener of the socket `'end'` event.
|
|
3874
3934
|
*
|
|
3875
3935
|
* @private
|
|
3876
3936
|
*/
|
|
@@ -3883,7 +3943,7 @@ function socketOnEnd() {
|
|
|
3883
3943
|
}
|
|
3884
3944
|
|
|
3885
3945
|
/**
|
|
3886
|
-
* The listener of the
|
|
3946
|
+
* The listener of the socket `'error'` event.
|
|
3887
3947
|
*
|
|
3888
3948
|
* @private
|
|
3889
3949
|
*/
|
|
@@ -3960,11 +4020,11 @@ function parse(header) {
|
|
|
3960
4020
|
|
|
3961
4021
|
var subprotocol$1 = { parse };
|
|
3962
4022
|
|
|
3963
|
-
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^
|
|
4023
|
+
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$" }] */
|
|
3964
4024
|
|
|
3965
4025
|
const EventEmitter = require$$2;
|
|
3966
4026
|
const http = require$$2$1;
|
|
3967
|
-
const { createHash } = require$$
|
|
4027
|
+
const { createHash } = require$$1;
|
|
3968
4028
|
|
|
3969
4029
|
const extension = extension$1;
|
|
3970
4030
|
const PerMessageDeflate = permessageDeflate;
|
|
@@ -4178,8 +4238,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
4178
4238
|
* Handle a HTTP Upgrade request.
|
|
4179
4239
|
*
|
|
4180
4240
|
* @param {http.IncomingMessage} req The request object
|
|
4181
|
-
* @param {
|
|
4182
|
-
* server and client
|
|
4241
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
4183
4242
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
4184
4243
|
* @param {Function} cb Callback
|
|
4185
4244
|
* @public
|
|
@@ -4303,8 +4362,7 @@ class WebSocketServer extends EventEmitter {
|
|
|
4303
4362
|
* @param {String} key The value of the `Sec-WebSocket-Key` header
|
|
4304
4363
|
* @param {Set} protocols The subprotocols
|
|
4305
4364
|
* @param {http.IncomingMessage} req The request object
|
|
4306
|
-
* @param {
|
|
4307
|
-
* server and client
|
|
4365
|
+
* @param {Duplex} socket The network socket between the server and client
|
|
4308
4366
|
* @param {Buffer} head The first packet of the upgraded stream
|
|
4309
4367
|
* @param {Function} cb Callback
|
|
4310
4368
|
* @throws {Error} If called more than once with the same socket
|
|
@@ -4434,7 +4492,7 @@ function socketOnError() {
|
|
|
4434
4492
|
/**
|
|
4435
4493
|
* Close the connection when preconditions are not fulfilled.
|
|
4436
4494
|
*
|
|
4437
|
-
* @param {
|
|
4495
|
+
* @param {Duplex} socket The socket of the upgrade request
|
|
4438
4496
|
* @param {Number} code The HTTP response status code
|
|
4439
4497
|
* @param {String} [message] The HTTP response body
|
|
4440
4498
|
* @param {Object} [headers] Additional HTTP response headers
|
|
@@ -4475,7 +4533,7 @@ function abortHandshake(socket, code, message, headers) {
|
|
|
4475
4533
|
*
|
|
4476
4534
|
* @param {WebSocketServer} server The WebSocket server
|
|
4477
4535
|
* @param {http.IncomingMessage} req The request object
|
|
4478
|
-
* @param {
|
|
4536
|
+
* @param {Duplex} socket The socket of the upgrade request
|
|
4479
4537
|
* @param {Number} code The HTTP response status code
|
|
4480
4538
|
* @param {String} message The HTTP response body
|
|
4481
4539
|
* @private
|