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