@rstest/core 0.0.1 → 0.0.2
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 +658 -0
- package/dist/202.js +365 -0
- package/dist/353.js +1 -1
- package/dist/81.js +1467 -0
- package/dist/813.js +4 -3
- package/dist/{773.js → 867.js} +188 -163
- package/dist/973.js +0 -72
- package/dist/992.js +18 -11
- package/dist/cli.js +127 -118
- package/dist/worker.js +306 -166
- package/dist-types/node.d.ts +1 -2
- package/dist-types/public.d.ts +95 -3
- package/dist-types/worker.d.ts +1 -2
- package/package.json +30 -11
package/dist/worker.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*! For license information please see worker.js.LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import node_process from "node:process";
|
|
3
|
+
import node_tty from "node:tty";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE__vitest_expect_97b57ccd__ from "@vitest/expect";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_692a7094__ from "@vitest/snapshot";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE_chai__ from "chai";
|
|
@@ -7,20 +8,23 @@ import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__ from "node:assert";
|
|
8
9
|
import * as __WEBPACK_EXTERNAL_MODULE_node_console_8631dfae__ from "node:console";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_timers_7045d530__ from "node:timers";
|
|
10
13
|
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
11
14
|
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
12
15
|
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
13
16
|
import * as __WEBPACK_EXTERNAL_MODULE_pathe__ from "pathe";
|
|
14
17
|
import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
|
|
18
|
+
import * as __WEBPACK_EXTERNAL_MODULE_util__ from "util";
|
|
15
19
|
import { createRequire } from "node:module";
|
|
16
20
|
import { isAbsolute } from "node:path";
|
|
17
21
|
import { pathToFileURL } from "node:url";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
22
|
+
import node_vm from "node:vm";
|
|
23
|
+
import node_v8 from "node:v8";
|
|
20
24
|
import { createBirpc } from "birpc";
|
|
21
25
|
import { NodeSnapshotEnvironment } from "@vitest/snapshot/environment";
|
|
22
26
|
var __webpack_modules__ = {
|
|
23
|
-
"../../node_modules/.pnpm/@jest+diff-sequences@30.0.
|
|
27
|
+
"../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js": function(module) {
|
|
24
28
|
/*!
|
|
25
29
|
* /**
|
|
26
30
|
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -337,7 +341,7 @@ var __webpack_modules__ = {
|
|
|
337
341
|
module.exports = __nested_webpack_exports__;
|
|
338
342
|
})();
|
|
339
343
|
},
|
|
340
|
-
"../../node_modules/.pnpm/@jest+get-type@30.0.
|
|
344
|
+
"../../node_modules/.pnpm/@jest+get-type@30.0.1/node_modules/@jest/get-type/build/index.js": function(module) {
|
|
341
345
|
/*!
|
|
342
346
|
* /**
|
|
343
347
|
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -2882,7 +2886,7 @@ var __webpack_modules__ = {
|
|
|
2882
2886
|
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
2883
2887
|
};
|
|
2884
2888
|
},
|
|
2885
|
-
"../../node_modules/.pnpm/jest-diff@30.0.
|
|
2889
|
+
"../../node_modules/.pnpm/jest-diff@30.0.2/node_modules/jest-diff/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
2886
2890
|
/*!
|
|
2887
2891
|
* /**
|
|
2888
2892
|
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -3194,7 +3198,7 @@ var __webpack_modules__ = {
|
|
|
3194
3198
|
value: true
|
|
3195
3199
|
});
|
|
3196
3200
|
exports.printDiffLines = exports.diffLinesUnified2 = exports.diffLinesUnified = exports.diffLinesRaw = void 0;
|
|
3197
|
-
var _diffSequences = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/@jest+diff-sequences@30.0.
|
|
3201
|
+
var _diffSequences = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js"));
|
|
3198
3202
|
var _cleanupSemantic = __nested_webpack_require_20541_20560__("./src/cleanupSemantic.ts");
|
|
3199
3203
|
var _joinAlignedDiffs = __nested_webpack_require_20541_20560__("./src/joinAlignedDiffs.ts");
|
|
3200
3204
|
var _normalizeDiffOptions = __nested_webpack_require_20541_20560__("./src/normalizeDiffOptions.ts");
|
|
@@ -3298,7 +3302,7 @@ var __webpack_modules__ = {
|
|
|
3298
3302
|
value: true
|
|
3299
3303
|
});
|
|
3300
3304
|
exports["default"] = void 0;
|
|
3301
|
-
var _diffSequences = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/@jest+diff-sequences@30.0.
|
|
3305
|
+
var _diffSequences = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js"));
|
|
3302
3306
|
var _cleanupSemantic = __nested_webpack_require_26333_26352__("./src/cleanupSemantic.ts");
|
|
3303
3307
|
function _interopRequireDefault(e) {
|
|
3304
3308
|
return e && e.__esModule ? e : {
|
|
@@ -3723,8 +3727,8 @@ var __webpack_modules__ = {
|
|
|
3723
3727
|
}
|
|
3724
3728
|
});
|
|
3725
3729
|
var _chalk = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js"));
|
|
3726
|
-
var _getType = __webpack_require__("../../node_modules/.pnpm/@jest+get-type@30.0.
|
|
3727
|
-
var _prettyFormat = __webpack_require__("../../node_modules/.pnpm/pretty-format@30.0.
|
|
3730
|
+
var _getType = __webpack_require__("../../node_modules/.pnpm/@jest+get-type@30.0.1/node_modules/@jest/get-type/build/index.js");
|
|
3731
|
+
var _prettyFormat = __webpack_require__("../../node_modules/.pnpm/pretty-format@30.0.2/node_modules/pretty-format/build/index.js");
|
|
3728
3732
|
var _cleanupSemantic = __nested_webpack_require_47190__("./src/cleanupSemantic.ts");
|
|
3729
3733
|
var _constants = __nested_webpack_require_47190__("./src/constants.ts");
|
|
3730
3734
|
var _diffLines = __nested_webpack_require_47190__("./src/diffLines.ts");
|
|
@@ -3907,7 +3911,7 @@ var __webpack_modules__ = {
|
|
|
3907
3911
|
module.exports = createColors();
|
|
3908
3912
|
module.exports.createColors = createColors;
|
|
3909
3913
|
},
|
|
3910
|
-
"../../node_modules/.pnpm/pretty-format@30.0.
|
|
3914
|
+
"../../node_modules/.pnpm/pretty-format@30.0.2/node_modules/pretty-format/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
3911
3915
|
/*!
|
|
3912
3916
|
* /**
|
|
3913
3917
|
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -4949,7 +4953,7 @@ var __webpack_modules__ = {
|
|
|
4949
4953
|
o: ()=>formatTestError
|
|
4950
4954
|
});
|
|
4951
4955
|
var external_node_util_ = __webpack_require__("node:util");
|
|
4952
|
-
var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.
|
|
4956
|
+
var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.2/node_modules/jest-diff/build/index.js");
|
|
4953
4957
|
build.DIFF_DELETE;
|
|
4954
4958
|
build.DIFF_EQUAL;
|
|
4955
4959
|
build.DIFF_INSERT;
|
|
@@ -5028,6 +5032,7 @@ var __webpack_modules__ = {
|
|
|
5028
5032
|
'beforeAll',
|
|
5029
5033
|
'beforeEach',
|
|
5030
5034
|
'rstest',
|
|
5035
|
+
'rs',
|
|
5031
5036
|
'assert'
|
|
5032
5037
|
];
|
|
5033
5038
|
},
|
|
@@ -5088,26 +5093,32 @@ var __webpack_modules__ = {
|
|
|
5088
5093
|
},
|
|
5089
5094
|
"./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
5090
5095
|
__webpack_require__.d(__webpack_exports__, {
|
|
5091
|
-
k: ()=>
|
|
5096
|
+
k: ()=>src_logger
|
|
5092
5097
|
});
|
|
5093
|
-
var
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
const prefix = flag.startsWith("-") ? "" : 1 === flag.length ? "-" : "--";
|
|
5098
|
+
var external_node_os_ = __webpack_require__("node:os");
|
|
5099
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
5100
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
5097
5101
|
const position = argv.indexOf(prefix + flag);
|
|
5098
|
-
const terminatorPosition = argv.indexOf(
|
|
5102
|
+
const terminatorPosition = argv.indexOf('--');
|
|
5099
5103
|
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
5100
5104
|
}
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
if (hasFlag(
|
|
5104
|
-
else if (hasFlag(
|
|
5105
|
+
const { env } = node_process;
|
|
5106
|
+
let flagForceColor;
|
|
5107
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
5108
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
5105
5109
|
function envForceColor() {
|
|
5106
|
-
if (
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5110
|
+
if (!('FORCE_COLOR' in env)) return;
|
|
5111
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
5112
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
5113
|
+
if (0 === env.FORCE_COLOR.length) return 1;
|
|
5114
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
5115
|
+
if (![
|
|
5116
|
+
0,
|
|
5117
|
+
1,
|
|
5118
|
+
2,
|
|
5119
|
+
3
|
|
5120
|
+
].includes(level)) return;
|
|
5121
|
+
return level;
|
|
5111
5122
|
}
|
|
5112
5123
|
function translateLevel(level) {
|
|
5113
5124
|
if (0 === level) return false;
|
|
@@ -5124,45 +5135,48 @@ var __webpack_modules__ = {
|
|
|
5124
5135
|
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
5125
5136
|
if (0 === forceColor) return 0;
|
|
5126
5137
|
if (sniffFlags) {
|
|
5127
|
-
if (hasFlag(
|
|
5128
|
-
if (hasFlag(
|
|
5138
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
5139
|
+
if (hasFlag('color=256')) return 2;
|
|
5129
5140
|
}
|
|
5130
|
-
if (
|
|
5141
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
5131
5142
|
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
5132
5143
|
const min = forceColor || 0;
|
|
5133
|
-
if (
|
|
5134
|
-
if (
|
|
5135
|
-
const osRelease =
|
|
5144
|
+
if ('dumb' === env.TERM) return min;
|
|
5145
|
+
if ('win32' === node_process.platform) {
|
|
5146
|
+
const osRelease = external_node_os_["default"].release().split('.');
|
|
5136
5147
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
5137
5148
|
return 1;
|
|
5138
5149
|
}
|
|
5139
|
-
if (
|
|
5140
|
-
if (
|
|
5150
|
+
if ('CI' in env) {
|
|
5151
|
+
if ([
|
|
5152
|
+
'GITHUB_ACTIONS',
|
|
5153
|
+
'GITEA_ACTIONS',
|
|
5154
|
+
'CIRCLECI'
|
|
5155
|
+
].some((key)=>key in env)) return 3;
|
|
5141
5156
|
if ([
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
].some((sign)=>sign in env) || "codeship" === env.CI_NAME) return 1;
|
|
5157
|
+
'TRAVIS',
|
|
5158
|
+
'APPVEYOR',
|
|
5159
|
+
'GITLAB_CI',
|
|
5160
|
+
'BUILDKITE',
|
|
5161
|
+
'DRONE'
|
|
5162
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
5149
5163
|
return min;
|
|
5150
5164
|
}
|
|
5151
|
-
if (
|
|
5152
|
-
if (
|
|
5153
|
-
if (
|
|
5154
|
-
if (
|
|
5155
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION ||
|
|
5165
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
5166
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
5167
|
+
if ('xterm-kitty' === env.TERM) return 3;
|
|
5168
|
+
if ('TERM_PROGRAM' in env) {
|
|
5169
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
5156
5170
|
switch(env.TERM_PROGRAM){
|
|
5157
|
-
case
|
|
5171
|
+
case 'iTerm.app':
|
|
5158
5172
|
return version >= 3 ? 3 : 2;
|
|
5159
|
-
case
|
|
5173
|
+
case 'Apple_Terminal':
|
|
5160
5174
|
return 2;
|
|
5161
5175
|
}
|
|
5162
5176
|
}
|
|
5163
5177
|
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
5164
5178
|
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
5165
|
-
if (
|
|
5179
|
+
if ('COLORTERM' in env) return 1;
|
|
5166
5180
|
return min;
|
|
5167
5181
|
}
|
|
5168
5182
|
function createSupportsColor(stream, options = {}) {
|
|
@@ -5172,49 +5186,49 @@ var __webpack_modules__ = {
|
|
|
5172
5186
|
});
|
|
5173
5187
|
return translateLevel(level);
|
|
5174
5188
|
}
|
|
5175
|
-
|
|
5189
|
+
const supportsColor = {
|
|
5176
5190
|
stdout: createSupportsColor({
|
|
5177
|
-
isTTY:
|
|
5191
|
+
isTTY: node_tty.isatty(1)
|
|
5178
5192
|
}),
|
|
5179
5193
|
stderr: createSupportsColor({
|
|
5180
|
-
isTTY:
|
|
5194
|
+
isTTY: node_tty.isatty(2)
|
|
5181
5195
|
})
|
|
5182
5196
|
};
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
let string =
|
|
5197
|
+
const supports_color = supportsColor;
|
|
5198
|
+
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
5199
|
+
let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
5200
|
+
let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
5201
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
5202
|
+
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
5203
|
+
let string = '' + input;
|
|
5190
5204
|
let index = string.indexOf(close, open.length);
|
|
5191
5205
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
5192
5206
|
} : String;
|
|
5193
|
-
|
|
5207
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
5194
5208
|
let start = string.substring(0, index) + replace;
|
|
5195
5209
|
let end = string.substring(index + close.length);
|
|
5196
5210
|
let nextIndex = end.indexOf(close);
|
|
5197
5211
|
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
5198
5212
|
};
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5213
|
+
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
5214
|
+
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
5215
|
+
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
5216
|
+
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
5217
|
+
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
5218
|
+
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
5219
|
+
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
5220
|
+
let startColor = [
|
|
5207
5221
|
189,
|
|
5208
5222
|
255,
|
|
5209
5223
|
243
|
|
5210
5224
|
];
|
|
5211
|
-
|
|
5225
|
+
let endColor = [
|
|
5212
5226
|
74,
|
|
5213
5227
|
194,
|
|
5214
5228
|
154
|
|
5215
5229
|
];
|
|
5216
|
-
|
|
5217
|
-
|
|
5230
|
+
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
5231
|
+
let gradient = (message)=>{
|
|
5218
5232
|
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
5219
5233
|
let chars = [
|
|
5220
5234
|
...message
|
|
@@ -5226,106 +5240,106 @@ var __webpack_modules__ = {
|
|
|
5226
5240
|
let rStep = (endColor[0] - r) / steps;
|
|
5227
5241
|
let gStep = (endColor[1] - g) / steps;
|
|
5228
5242
|
let bStep = (endColor[2] - b) / steps;
|
|
5229
|
-
let output =
|
|
5243
|
+
let output = '';
|
|
5230
5244
|
for (let char of chars){
|
|
5231
5245
|
if (isWord(char)) {
|
|
5232
5246
|
r += rStep;
|
|
5233
5247
|
g += gStep;
|
|
5234
5248
|
b += bStep;
|
|
5235
5249
|
}
|
|
5236
|
-
output += `\
|
|
5250
|
+
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
5237
5251
|
}
|
|
5238
5252
|
return bold(output);
|
|
5239
5253
|
};
|
|
5240
|
-
|
|
5254
|
+
let LOG_LEVEL = {
|
|
5255
|
+
silent: -1,
|
|
5241
5256
|
error: 0,
|
|
5242
5257
|
warn: 1,
|
|
5243
5258
|
info: 2,
|
|
5244
|
-
log:
|
|
5245
|
-
verbose:
|
|
5259
|
+
log: 2,
|
|
5260
|
+
verbose: 3
|
|
5246
5261
|
};
|
|
5247
|
-
|
|
5262
|
+
let LOG_TYPES = {
|
|
5248
5263
|
error: {
|
|
5249
|
-
label:
|
|
5250
|
-
level:
|
|
5264
|
+
label: 'error',
|
|
5265
|
+
level: 'error',
|
|
5251
5266
|
color: red
|
|
5252
5267
|
},
|
|
5253
5268
|
warn: {
|
|
5254
|
-
label:
|
|
5255
|
-
level:
|
|
5269
|
+
label: 'warn',
|
|
5270
|
+
level: 'warn',
|
|
5256
5271
|
color: yellow
|
|
5257
5272
|
},
|
|
5258
5273
|
info: {
|
|
5259
|
-
label:
|
|
5260
|
-
level:
|
|
5274
|
+
label: 'info',
|
|
5275
|
+
level: 'info',
|
|
5261
5276
|
color: cyan
|
|
5262
5277
|
},
|
|
5263
5278
|
start: {
|
|
5264
|
-
label:
|
|
5265
|
-
level:
|
|
5279
|
+
label: 'start',
|
|
5280
|
+
level: 'info',
|
|
5266
5281
|
color: cyan
|
|
5267
5282
|
},
|
|
5268
5283
|
ready: {
|
|
5269
|
-
label:
|
|
5270
|
-
level:
|
|
5284
|
+
label: 'ready',
|
|
5285
|
+
level: 'info',
|
|
5271
5286
|
color: green
|
|
5272
5287
|
},
|
|
5273
5288
|
success: {
|
|
5274
|
-
label:
|
|
5275
|
-
level:
|
|
5289
|
+
label: 'success',
|
|
5290
|
+
level: 'info',
|
|
5276
5291
|
color: green
|
|
5277
5292
|
},
|
|
5278
5293
|
log: {
|
|
5279
|
-
level:
|
|
5294
|
+
level: 'info'
|
|
5280
5295
|
},
|
|
5281
5296
|
debug: {
|
|
5282
|
-
label:
|
|
5283
|
-
level:
|
|
5297
|
+
label: 'debug',
|
|
5298
|
+
level: 'verbose',
|
|
5284
5299
|
color: magenta
|
|
5285
5300
|
}
|
|
5286
5301
|
};
|
|
5287
|
-
|
|
5288
|
-
let maxLevel = options.level ||
|
|
5302
|
+
let createLogger = (options = {})=>{
|
|
5303
|
+
let maxLevel = options.level || 'info';
|
|
5289
5304
|
let log = (type, message, ...args)=>{
|
|
5290
5305
|
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
5291
5306
|
if (null == message) return console.log();
|
|
5292
5307
|
let logType = LOG_TYPES[type];
|
|
5293
|
-
let label =
|
|
5294
|
-
let text =
|
|
5295
|
-
if (
|
|
5296
|
-
label = (logType.label ||
|
|
5308
|
+
let label = '';
|
|
5309
|
+
let text = '';
|
|
5310
|
+
if ('label' in logType) {
|
|
5311
|
+
label = (logType.label || '').padEnd(7);
|
|
5297
5312
|
label = bold(logType.color ? logType.color(label) : label);
|
|
5298
5313
|
}
|
|
5299
5314
|
if (message instanceof Error) if (message.stack) {
|
|
5300
|
-
let [name, ...rest] = message.stack.split(
|
|
5301
|
-
if (name.startsWith(
|
|
5302
|
-
text = `${name}
|
|
5303
|
-
${gray(rest.join("\n"))}`;
|
|
5315
|
+
let [name, ...rest] = message.stack.split('\n');
|
|
5316
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
5317
|
+
text = `${name}\n${gray(rest.join('\n'))}`;
|
|
5304
5318
|
} else text = message.message;
|
|
5305
|
-
else if (
|
|
5306
|
-
let lines = message.split(
|
|
5307
|
-
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join(
|
|
5319
|
+
else if ('error' === logType.level && 'string' == typeof message) {
|
|
5320
|
+
let lines = message.split('\n');
|
|
5321
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
5308
5322
|
} else text = `${message}`;
|
|
5309
5323
|
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
5310
5324
|
};
|
|
5311
|
-
let
|
|
5312
|
-
greet: (message)=>log(
|
|
5325
|
+
let logger = {
|
|
5326
|
+
greet: (message)=>log('log', gradient(message))
|
|
5313
5327
|
};
|
|
5314
5328
|
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
5315
|
-
|
|
5329
|
+
logger[key] = (...args)=>log(key, ...args);
|
|
5316
5330
|
});
|
|
5317
|
-
Object.defineProperty(
|
|
5331
|
+
Object.defineProperty(logger, 'level', {
|
|
5318
5332
|
get: ()=>maxLevel,
|
|
5319
5333
|
set (val) {
|
|
5320
5334
|
maxLevel = val;
|
|
5321
5335
|
}
|
|
5322
5336
|
});
|
|
5323
|
-
|
|
5324
|
-
Object.assign(
|
|
5337
|
+
logger.override = (customLogger)=>{
|
|
5338
|
+
Object.assign(logger, customLogger);
|
|
5325
5339
|
};
|
|
5326
|
-
return
|
|
5340
|
+
return logger;
|
|
5327
5341
|
};
|
|
5328
|
-
|
|
5342
|
+
let src_logger = createLogger();
|
|
5329
5343
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
5330
5344
|
const isDebug = ()=>{
|
|
5331
5345
|
if (!process.env.DEBUG) return false;
|
|
@@ -5337,7 +5351,7 @@ ${gray(rest.join("\n"))}`;
|
|
|
5337
5351
|
'*'
|
|
5338
5352
|
].some((key)=>values.includes(key));
|
|
5339
5353
|
};
|
|
5340
|
-
if (isDebug())
|
|
5354
|
+
if (isDebug()) src_logger.level = 'verbose';
|
|
5341
5355
|
function getTime() {
|
|
5342
5356
|
const now = new Date();
|
|
5343
5357
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
@@ -5345,14 +5359,20 @@ ${gray(rest.join("\n"))}`;
|
|
|
5345
5359
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
5346
5360
|
return `${hours}:${minutes}:${seconds}`;
|
|
5347
5361
|
}
|
|
5348
|
-
|
|
5362
|
+
src_logger.override({
|
|
5349
5363
|
debug: (message, ...args)=>{
|
|
5350
|
-
if ('verbose' !==
|
|
5364
|
+
if ('verbose' !== src_logger.level) return;
|
|
5351
5365
|
const time = helper.$_.gray(`${getTime()}`);
|
|
5352
5366
|
console.log(` ${helper.$_.magenta('rstest')} ${time} ${message}`, ...args);
|
|
5353
5367
|
}
|
|
5354
5368
|
});
|
|
5355
5369
|
},
|
|
5370
|
+
timers: function(module) {
|
|
5371
|
+
module.exports = require("timers");
|
|
5372
|
+
},
|
|
5373
|
+
"timers/promises": function(module) {
|
|
5374
|
+
module.exports = require("timers/promises");
|
|
5375
|
+
},
|
|
5356
5376
|
"@vitest/expect": function(module) {
|
|
5357
5377
|
module.exports = __WEBPACK_EXTERNAL_MODULE__vitest_expect_97b57ccd__;
|
|
5358
5378
|
},
|
|
@@ -5374,6 +5394,12 @@ ${gray(rest.join("\n"))}`;
|
|
|
5374
5394
|
"node:fs/promises": function(module) {
|
|
5375
5395
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
|
|
5376
5396
|
},
|
|
5397
|
+
"node:os": function(module) {
|
|
5398
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
|
|
5399
|
+
},
|
|
5400
|
+
"node:timers": function(module) {
|
|
5401
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_timers_7045d530__;
|
|
5402
|
+
},
|
|
5377
5403
|
"node:util": function(module) {
|
|
5378
5404
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__;
|
|
5379
5405
|
},
|
|
@@ -5388,6 +5414,9 @@ ${gray(rest.join("\n"))}`;
|
|
|
5388
5414
|
},
|
|
5389
5415
|
tty: function(module) {
|
|
5390
5416
|
module.exports = __WEBPACK_EXTERNAL_MODULE_tty__;
|
|
5417
|
+
},
|
|
5418
|
+
util: function(module) {
|
|
5419
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_util__;
|
|
5391
5420
|
}
|
|
5392
5421
|
};
|
|
5393
5422
|
var __webpack_module_cache__ = {};
|
|
@@ -5399,7 +5428,7 @@ function __webpack_require__(moduleId) {
|
|
|
5399
5428
|
loaded: false,
|
|
5400
5429
|
exports: {}
|
|
5401
5430
|
};
|
|
5402
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
5431
|
+
__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
5403
5432
|
module.loaded = true;
|
|
5404
5433
|
return module.exports;
|
|
5405
5434
|
}
|
|
@@ -5521,10 +5550,52 @@ var helper = __webpack_require__("./src/utils/helper.ts");
|
|
|
5521
5550
|
var util = __webpack_require__("./src/runtime/util.ts");
|
|
5522
5551
|
var external_pathe_ = __webpack_require__("pathe");
|
|
5523
5552
|
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
5553
|
+
const shouldInterop = ({ interopDefault = true, modulePath, mod })=>{
|
|
5554
|
+
if (false === interopDefault) return false;
|
|
5555
|
+
return !modulePath.endsWith('.mjs') && 'default' in mod;
|
|
5556
|
+
};
|
|
5557
|
+
const isPrimitive = (v)=>v !== Object(v);
|
|
5558
|
+
function interopModule(mod) {
|
|
5559
|
+
if (isPrimitive(mod)) return {
|
|
5560
|
+
mod: {
|
|
5561
|
+
default: mod
|
|
5562
|
+
},
|
|
5563
|
+
defaultExport: mod
|
|
5564
|
+
};
|
|
5565
|
+
const defaultExport = 'default' in mod ? mod.default : mod;
|
|
5566
|
+
if (!isPrimitive(defaultExport) && '__esModule' in defaultExport) return {
|
|
5567
|
+
mod: defaultExport,
|
|
5568
|
+
defaultExport: 'default' in defaultExport ? defaultExport.default : defaultExport
|
|
5569
|
+
};
|
|
5570
|
+
return {
|
|
5571
|
+
mod,
|
|
5572
|
+
defaultExport
|
|
5573
|
+
};
|
|
5574
|
+
}
|
|
5575
|
+
const asModule = async (something, defaultExport, context, unlinked)=>{
|
|
5576
|
+
const { Module, SyntheticModule } = await import("node:vm");
|
|
5577
|
+
if (something instanceof Module) return something;
|
|
5578
|
+
const exports = [
|
|
5579
|
+
...new Set([
|
|
5580
|
+
'default',
|
|
5581
|
+
...Object.keys(something)
|
|
5582
|
+
])
|
|
5583
|
+
];
|
|
5584
|
+
const m = new SyntheticModule(exports, ()=>{
|
|
5585
|
+
for (const name of exports)m.setExport(name, 'default' === name ? defaultExport : something[name]);
|
|
5586
|
+
}, {
|
|
5587
|
+
context
|
|
5588
|
+
});
|
|
5589
|
+
if (unlinked) return m;
|
|
5590
|
+
await m.link(()=>{});
|
|
5591
|
+
if (m.instantiate) m.instantiate();
|
|
5592
|
+
await m.evaluate();
|
|
5593
|
+
return m;
|
|
5594
|
+
};
|
|
5524
5595
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
5525
|
-
const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles)=>{
|
|
5596
|
+
const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
|
|
5526
5597
|
const _require = createRequire(filename);
|
|
5527
|
-
const
|
|
5598
|
+
const require1 = (id)=>{
|
|
5528
5599
|
const currentDirectory = external_pathe_["default"].dirname(distPath);
|
|
5529
5600
|
const joinedPath = isRelativePath(id) ? external_pathe_["default"].join(currentDirectory, id) : id;
|
|
5530
5601
|
const content = assetFiles[joinedPath];
|
|
@@ -5534,7 +5605,8 @@ const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles)
|
|
|
5534
5605
|
testPath: joinedPath,
|
|
5535
5606
|
distPath: joinedPath,
|
|
5536
5607
|
rstestContext,
|
|
5537
|
-
assetFiles
|
|
5608
|
+
assetFiles,
|
|
5609
|
+
interopDefault
|
|
5538
5610
|
});
|
|
5539
5611
|
} catch (err) {
|
|
5540
5612
|
logger.k.error(`load file ${joinedPath} failed:\n`, err instanceof Error ? err.message : err);
|
|
@@ -5542,11 +5614,11 @@ const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles)
|
|
|
5542
5614
|
const resolved = _require.resolve(id);
|
|
5543
5615
|
return _require(resolved);
|
|
5544
5616
|
};
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
return
|
|
5617
|
+
require1.resolve = _require.resolve;
|
|
5618
|
+
require1.main = _require.main;
|
|
5619
|
+
return require1;
|
|
5548
5620
|
};
|
|
5549
|
-
const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles })=>{
|
|
5621
|
+
const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles, interopDefault })=>{
|
|
5550
5622
|
const fileDir = external_pathe_["default"].dirname(testPath);
|
|
5551
5623
|
const localModule = {
|
|
5552
5624
|
children: [],
|
|
@@ -5560,22 +5632,30 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
|
|
|
5560
5632
|
const context = {
|
|
5561
5633
|
module: localModule,
|
|
5562
5634
|
exports: localModule.exports,
|
|
5563
|
-
require: loadModule_createRequire(testPath, distPath, rstestContext, assetFiles),
|
|
5635
|
+
require: loadModule_createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
|
|
5564
5636
|
__dirname: fileDir,
|
|
5565
5637
|
__filename: testPath,
|
|
5566
5638
|
...rstestContext
|
|
5567
5639
|
};
|
|
5568
|
-
const codeDefinition = `'use strict';(${Object.keys(context).join(',')})=>{
|
|
5569
|
-
const code = `${codeDefinition}${codeContent}\n}
|
|
5570
|
-
const fn =
|
|
5640
|
+
const codeDefinition = `'use strict';(${Object.keys(context).join(',')})=>{`;
|
|
5641
|
+
const code = `${codeDefinition}${codeContent}\n}`;
|
|
5642
|
+
const fn = node_vm.runInThisContext(code, {
|
|
5571
5643
|
filename: distPath,
|
|
5572
5644
|
lineOffset: 0,
|
|
5573
5645
|
columnOffset: -codeDefinition.length,
|
|
5574
5646
|
importModuleDynamically: async (specifier, _referencer, importAttributes)=>{
|
|
5575
|
-
|
|
5576
|
-
const
|
|
5577
|
-
const
|
|
5578
|
-
|
|
5647
|
+
const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : await import.meta.resolve(specifier, pathToFileURL(testPath));
|
|
5648
|
+
const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
|
|
5649
|
+
const importedModule = await import(modulePath, importAttributes);
|
|
5650
|
+
if (shouldInterop({
|
|
5651
|
+
interopDefault,
|
|
5652
|
+
modulePath,
|
|
5653
|
+
mod: importedModule
|
|
5654
|
+
})) {
|
|
5655
|
+
const { mod, defaultExport } = interopModule(importedModule);
|
|
5656
|
+
return asModule(mod, defaultExport);
|
|
5657
|
+
}
|
|
5658
|
+
return importedModule;
|
|
5579
5659
|
}
|
|
5580
5660
|
});
|
|
5581
5661
|
fn(...Object.values(context));
|
|
@@ -5585,7 +5665,7 @@ const processSend = process.send.bind(process);
|
|
|
5585
5665
|
const processOn = process.on.bind(process);
|
|
5586
5666
|
const processOff = process.off.bind(process);
|
|
5587
5667
|
const dispose = [];
|
|
5588
|
-
function createForksRpcOptions(nodeV8 =
|
|
5668
|
+
function createForksRpcOptions(nodeV8 = node_v8) {
|
|
5589
5669
|
return {
|
|
5590
5670
|
serialize: nodeV8.serialize,
|
|
5591
5671
|
deserialize: (v)=>nodeV8.deserialize(Buffer.from(v)),
|
|
@@ -5619,8 +5699,18 @@ const getGlobalApi = (api)=>constants.io.reduce((apis, key)=>{
|
|
|
5619
5699
|
}, {});
|
|
5620
5700
|
const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, updateSnapshot, context })=>{
|
|
5621
5701
|
context.runtimeConfig = (0, helper.PQ)(context.runtimeConfig);
|
|
5702
|
+
const cleanupFns = [];
|
|
5622
5703
|
const { rpc } = createRuntimeRpc(createForksRpcOptions());
|
|
5623
|
-
const { runtimeConfig: { globals, printConsoleTrace, disableConsoleIntercept } } = context;
|
|
5704
|
+
const { runtimeConfig: { globals, printConsoleTrace, disableConsoleIntercept, testEnvironment } } = context;
|
|
5705
|
+
if (!disableConsoleIntercept) {
|
|
5706
|
+
const { createCustomConsole } = await __webpack_require__.e("813").then(__webpack_require__.bind(__webpack_require__, "./src/runtime/worker/console.ts"));
|
|
5707
|
+
global.console = createCustomConsole({
|
|
5708
|
+
rpc,
|
|
5709
|
+
testPath,
|
|
5710
|
+
printConsoleTrace
|
|
5711
|
+
});
|
|
5712
|
+
}
|
|
5713
|
+
const interopDefault = true;
|
|
5624
5714
|
const workerState = {
|
|
5625
5715
|
...context,
|
|
5626
5716
|
snapshotOptions: {
|
|
@@ -5631,7 +5721,10 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
|
|
|
5631
5721
|
testPath,
|
|
5632
5722
|
environment: 'node'
|
|
5633
5723
|
};
|
|
5634
|
-
const { createRstestRuntime } = await
|
|
5724
|
+
const { createRstestRuntime } = await Promise.all([
|
|
5725
|
+
__webpack_require__.e("81"),
|
|
5726
|
+
__webpack_require__.e("867")
|
|
5727
|
+
]).then(__webpack_require__.bind(__webpack_require__, "./src/runtime/api/index.ts"));
|
|
5635
5728
|
const { install } = await __webpack_require__.e("64").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js", 23));
|
|
5636
5729
|
install({
|
|
5637
5730
|
retrieveSourceMap: (source)=>{
|
|
@@ -5642,55 +5735,85 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
|
|
|
5642
5735
|
return null;
|
|
5643
5736
|
}
|
|
5644
5737
|
});
|
|
5645
|
-
const
|
|
5738
|
+
const unhandledErrors = [];
|
|
5739
|
+
const handleError = (e, type)=>{
|
|
5740
|
+
e.name = type;
|
|
5741
|
+
console.error(e);
|
|
5742
|
+
unhandledErrors.push(e);
|
|
5743
|
+
};
|
|
5744
|
+
const uncaughtException = (e)=>handleError(e, 'uncaughtException');
|
|
5745
|
+
const unhandledRejection = (e)=>handleError(e, 'unhandledRejection');
|
|
5746
|
+
process.on('uncaughtException', uncaughtException);
|
|
5747
|
+
process.on('unhandledRejection', unhandledRejection);
|
|
5748
|
+
cleanupFns.push(()=>{
|
|
5749
|
+
process.off('uncaughtException', uncaughtException);
|
|
5750
|
+
process.off('unhandledRejection', unhandledRejection);
|
|
5751
|
+
});
|
|
5646
5752
|
const { api, runner } = createRstestRuntime(workerState);
|
|
5753
|
+
if ('jsdom' === testEnvironment) {
|
|
5754
|
+
const { environment } = await __webpack_require__.e("202").then(__webpack_require__.bind(__webpack_require__, "./src/runtime/worker/env/jsdom.ts"));
|
|
5755
|
+
const { teardown } = await environment.setup(global, {});
|
|
5756
|
+
cleanupFns.push(()=>teardown(global));
|
|
5757
|
+
}
|
|
5647
5758
|
const rstestContext = {
|
|
5648
|
-
global
|
|
5649
|
-
|
|
5650
|
-
},
|
|
5651
|
-
console: disableConsoleIntercept ? console : createCustomConsole({
|
|
5652
|
-
rpc,
|
|
5653
|
-
testPath,
|
|
5654
|
-
printConsoleTrace
|
|
5655
|
-
}),
|
|
5759
|
+
global,
|
|
5760
|
+
console: global.console,
|
|
5656
5761
|
Error,
|
|
5657
5762
|
...globals ? getGlobalApi(api) : {}
|
|
5658
5763
|
};
|
|
5764
|
+
rstestContext.global['@rstest/core'] = api;
|
|
5659
5765
|
return {
|
|
5766
|
+
interopDefault,
|
|
5660
5767
|
rstestContext,
|
|
5661
5768
|
runner,
|
|
5662
5769
|
rpc,
|
|
5663
|
-
api
|
|
5770
|
+
api,
|
|
5771
|
+
unhandledErrors,
|
|
5772
|
+
cleanup: async ()=>{
|
|
5773
|
+
await Promise.all(cleanupFns.map((fn)=>fn()));
|
|
5774
|
+
}
|
|
5664
5775
|
};
|
|
5665
5776
|
};
|
|
5666
|
-
const
|
|
5667
|
-
const {
|
|
5668
|
-
|
|
5669
|
-
const loadFiles = async ()=>{
|
|
5670
|
-
for (const { distPath, testPath } of setupEntries){
|
|
5671
|
-
const setupCodeContent = assetFiles[distPath];
|
|
5672
|
-
await loadModule({
|
|
5673
|
-
codeContent: setupCodeContent,
|
|
5674
|
-
distPath,
|
|
5675
|
-
testPath,
|
|
5676
|
-
rstestContext,
|
|
5677
|
-
assetFiles
|
|
5678
|
-
});
|
|
5679
|
-
}
|
|
5777
|
+
const loadFiles = async ({ setupEntries, assetFiles, rstestContext, distPath, testPath, interopDefault })=>{
|
|
5778
|
+
for (const { distPath, testPath } of setupEntries){
|
|
5779
|
+
const setupCodeContent = assetFiles[distPath];
|
|
5680
5780
|
await loadModule({
|
|
5681
|
-
codeContent:
|
|
5781
|
+
codeContent: setupCodeContent,
|
|
5682
5782
|
distPath,
|
|
5683
5783
|
testPath,
|
|
5684
5784
|
rstestContext,
|
|
5685
|
-
assetFiles
|
|
5785
|
+
assetFiles,
|
|
5786
|
+
interopDefault
|
|
5686
5787
|
});
|
|
5687
|
-
}
|
|
5788
|
+
}
|
|
5789
|
+
await loadModule({
|
|
5790
|
+
codeContent: assetFiles[distPath],
|
|
5791
|
+
distPath,
|
|
5792
|
+
testPath,
|
|
5793
|
+
rstestContext,
|
|
5794
|
+
assetFiles,
|
|
5795
|
+
interopDefault
|
|
5796
|
+
});
|
|
5797
|
+
};
|
|
5798
|
+
const runInPool = async (options)=>{
|
|
5799
|
+
const { entryInfo: { distPath, testPath }, setupEntries, assetFiles, type } = options;
|
|
5800
|
+
const cleanups = [];
|
|
5688
5801
|
if ('collect' === type) try {
|
|
5689
|
-
await
|
|
5802
|
+
const { rstestContext, runner, cleanup, unhandledErrors, interopDefault } = await preparePool(options);
|
|
5803
|
+
cleanups.push(cleanup);
|
|
5804
|
+
await loadFiles({
|
|
5805
|
+
rstestContext,
|
|
5806
|
+
distPath,
|
|
5807
|
+
testPath,
|
|
5808
|
+
assetFiles,
|
|
5809
|
+
setupEntries,
|
|
5810
|
+
interopDefault
|
|
5811
|
+
});
|
|
5690
5812
|
const tests = await runner.collectTests();
|
|
5691
5813
|
return {
|
|
5692
5814
|
testPath,
|
|
5693
|
-
tests
|
|
5815
|
+
tests,
|
|
5816
|
+
errors: (0, util.o)(unhandledErrors)
|
|
5694
5817
|
};
|
|
5695
5818
|
} catch (err) {
|
|
5696
5819
|
return {
|
|
@@ -5698,9 +5821,20 @@ const runInPool = async (options)=>{
|
|
|
5698
5821
|
tests: [],
|
|
5699
5822
|
errors: (0, util.o)(err)
|
|
5700
5823
|
};
|
|
5824
|
+
} finally{
|
|
5825
|
+
await Promise.all(cleanups.map((fn)=>fn()));
|
|
5701
5826
|
}
|
|
5702
5827
|
try {
|
|
5703
|
-
await
|
|
5828
|
+
const { rstestContext, runner, rpc, api, cleanup, unhandledErrors, interopDefault } = await preparePool(options);
|
|
5829
|
+
cleanups.push(cleanup);
|
|
5830
|
+
await loadFiles({
|
|
5831
|
+
rstestContext,
|
|
5832
|
+
distPath,
|
|
5833
|
+
testPath,
|
|
5834
|
+
assetFiles,
|
|
5835
|
+
setupEntries,
|
|
5836
|
+
interopDefault
|
|
5837
|
+
});
|
|
5704
5838
|
const results = await runner.runTests(testPath, {
|
|
5705
5839
|
onTestFileStart: async (test)=>{
|
|
5706
5840
|
await rpc.onTestFileStart(test);
|
|
@@ -5712,6 +5846,10 @@ const runInPool = async (options)=>{
|
|
|
5712
5846
|
await rpc.onTestCaseResult(result);
|
|
5713
5847
|
}
|
|
5714
5848
|
}, api);
|
|
5849
|
+
if (unhandledErrors.length > 0) {
|
|
5850
|
+
results.status = 'fail';
|
|
5851
|
+
results.errors = (results.errors || []).concat(...(0, util.o)(unhandledErrors));
|
|
5852
|
+
}
|
|
5715
5853
|
return results;
|
|
5716
5854
|
} catch (err) {
|
|
5717
5855
|
return {
|
|
@@ -5721,6 +5859,8 @@ const runInPool = async (options)=>{
|
|
|
5721
5859
|
results: [],
|
|
5722
5860
|
errors: (0, util.o)(err)
|
|
5723
5861
|
};
|
|
5862
|
+
} finally{
|
|
5863
|
+
await Promise.all(cleanups.map((fn)=>fn()));
|
|
5724
5864
|
}
|
|
5725
5865
|
};
|
|
5726
5866
|
const worker = runInPool;
|