@rstest/core 0.7.0 → 0.7.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.md +1 -1
- package/dist/0~122.js +53 -23
- package/dist/0~151.js +303 -264
- package/dist/0~173.js +7 -2
- package/dist/0~346.js +46 -0
- package/dist/0~583.js +1 -1
- package/dist/0~588.js +1 -1
- package/dist/0~62.js +1 -1
- package/dist/0~634.js +3 -3
- package/dist/0~809.js +1 -1
- package/dist/0~835.js +143 -0
- package/dist/0~919.js +65 -33
- package/dist/0~923.js +149 -0
- package/dist/{155.js → 131.js} +14 -12
- package/dist/404.js +210 -0
- package/dist/{362.js → 554.js} +85 -233
- package/dist/734.js +1 -1
- package/dist/946.js +40 -30
- package/dist/index.d.ts +52 -18
- package/dist/index.js +1 -1
- package/dist/worker.d.ts +56 -24
- package/dist/worker.js +1 -1
- package/package.json +7 -6
- package/dist/770.js +0 -167
- /package/dist/{0~454.js → 0~907.js} +0 -0
- /package/dist/{362.js.LICENSE.txt → 554.js.LICENSE.txt} +0 -0
package/dist/946.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import * as
|
|
3
|
+
import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
|
|
4
|
+
import * as __rspack_external_node_os_74b4b876 from "node:os";
|
|
5
|
+
import * as __rspack_external_node_path_c5b9b54f from "node:path";
|
|
6
|
+
import * as __rspack_external_node_tty_c64aab7e from "node:tty";
|
|
7
|
+
import * as __rspack_external_node_util_1b29d436 from "node:util";
|
|
8
8
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
9
9
|
import node_process from "node:process";
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
@@ -12,7 +12,7 @@ import { createRequire } from "module";
|
|
|
12
12
|
import promises, { lstat, readdir, realpath, stat as promises_stat, writeFile } from "node:fs/promises";
|
|
13
13
|
import { createRequire as external_node_module_createRequire, isBuiltin } from "node:module";
|
|
14
14
|
__webpack_require__.add({
|
|
15
|
-
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"
|
|
15
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
|
|
16
16
|
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
17
17
|
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
18
18
|
let formatter = (open, close, replace = open)=>(input)=>{
|
|
@@ -78,7 +78,7 @@ __webpack_require__.add({
|
|
|
78
78
|
module.exports = createColors();
|
|
79
79
|
module.exports.createColors = createColors;
|
|
80
80
|
},
|
|
81
|
-
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js"
|
|
81
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
82
82
|
const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js");
|
|
83
83
|
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
84
84
|
function picomatch(glob, options, returnState = false) {
|
|
@@ -91,7 +91,7 @@ __webpack_require__.add({
|
|
|
91
91
|
Object.assign(picomatch, pico);
|
|
92
92
|
module.exports = picomatch;
|
|
93
93
|
},
|
|
94
|
-
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js"
|
|
94
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js" (module) {
|
|
95
95
|
const WIN_SLASH = '\\\\/';
|
|
96
96
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
97
97
|
const DOT_LITERAL = '\\.';
|
|
@@ -251,7 +251,7 @@ __webpack_require__.add({
|
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
253
|
},
|
|
254
|
-
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js"
|
|
254
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
255
255
|
const constants = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js");
|
|
256
256
|
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
257
257
|
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
|
|
@@ -1039,7 +1039,7 @@ __webpack_require__.add({
|
|
|
1039
1039
|
};
|
|
1040
1040
|
module.exports = parse;
|
|
1041
1041
|
},
|
|
1042
|
-
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js"
|
|
1042
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
1043
1043
|
const scan = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js");
|
|
1044
1044
|
const parse = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.js");
|
|
1045
1045
|
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
@@ -1172,7 +1172,7 @@ __webpack_require__.add({
|
|
|
1172
1172
|
picomatch.constants = constants;
|
|
1173
1173
|
module.exports = picomatch;
|
|
1174
1174
|
},
|
|
1175
|
-
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js"
|
|
1175
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js" (module, __unused_webpack_exports, __webpack_require__) {
|
|
1176
1176
|
const utils = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js");
|
|
1177
1177
|
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js");
|
|
1178
1178
|
const isPathSeparator = (code)=>code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
@@ -1440,7 +1440,7 @@ __webpack_require__.add({
|
|
|
1440
1440
|
};
|
|
1441
1441
|
module.exports = scan;
|
|
1442
1442
|
},
|
|
1443
|
-
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js"
|
|
1443
|
+
"../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js" (__unused_webpack_module, exports, __webpack_require__) {
|
|
1444
1444
|
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js");
|
|
1445
1445
|
exports.isObject = (val)=>null !== val && 'object' == typeof val && !Array.isArray(val);
|
|
1446
1446
|
exports.hasRegexChars = (str)=>REGEX_SPECIAL_CHARS.test(str);
|
|
@@ -1484,20 +1484,20 @@ __webpack_require__.add({
|
|
|
1484
1484
|
return last;
|
|
1485
1485
|
};
|
|
1486
1486
|
},
|
|
1487
|
-
"node:fs"
|
|
1488
|
-
module.exports =
|
|
1487
|
+
"node:fs" (module) {
|
|
1488
|
+
module.exports = __rspack_external_node_fs_5ea92f0c;
|
|
1489
1489
|
},
|
|
1490
|
-
"node:os"
|
|
1491
|
-
module.exports =
|
|
1490
|
+
"node:os" (module) {
|
|
1491
|
+
module.exports = __rspack_external_node_os_74b4b876;
|
|
1492
1492
|
},
|
|
1493
|
-
"node:path"
|
|
1494
|
-
module.exports =
|
|
1493
|
+
"node:path" (module) {
|
|
1494
|
+
module.exports = __rspack_external_node_path_c5b9b54f;
|
|
1495
1495
|
},
|
|
1496
|
-
"node:tty"
|
|
1497
|
-
module.exports =
|
|
1496
|
+
"node:tty" (module) {
|
|
1497
|
+
module.exports = __rspack_external_node_tty_c64aab7e;
|
|
1498
1498
|
},
|
|
1499
|
-
"node:util"
|
|
1500
|
-
module.exports =
|
|
1499
|
+
"node:util" (module) {
|
|
1500
|
+
module.exports = __rspack_external_node_util_1b29d436;
|
|
1501
1501
|
}
|
|
1502
1502
|
});
|
|
1503
1503
|
const external_node_os_ = __webpack_require__("node:os");
|
|
@@ -1604,9 +1604,10 @@ const supportsColor = {
|
|
|
1604
1604
|
};
|
|
1605
1605
|
const supports_color = supportsColor;
|
|
1606
1606
|
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
1607
|
-
let errorStackRegExp = /at\
|
|
1608
|
-
let anonymousErrorStackRegExp = /at\
|
|
1609
|
-
let
|
|
1607
|
+
let errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/;
|
|
1608
|
+
let anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/;
|
|
1609
|
+
let indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/;
|
|
1610
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message) || indexErrorStackRegExp.test(message);
|
|
1610
1611
|
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
1611
1612
|
let string = '' + input;
|
|
1612
1613
|
let index = string.indexOf(close, open.length);
|
|
@@ -1718,9 +1719,10 @@ const normalizeErrorMessage = (err)=>{
|
|
|
1718
1719
|
let createLogger = (options = {})=>{
|
|
1719
1720
|
let maxLevel = options.level || 'info';
|
|
1720
1721
|
let log = (type, message, ...args)=>{
|
|
1721
|
-
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
1722
|
-
if (null == message) return console.log();
|
|
1723
1722
|
let logType = LOG_TYPES[type];
|
|
1723
|
+
const { level } = logType;
|
|
1724
|
+
if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
|
|
1725
|
+
if (null == message) return console.log();
|
|
1724
1726
|
let label = '';
|
|
1725
1727
|
let text = '';
|
|
1726
1728
|
if ('label' in logType) {
|
|
@@ -1734,11 +1736,12 @@ let createLogger = (options = {})=>{
|
|
|
1734
1736
|
text += yellow('\n [cause]: ');
|
|
1735
1737
|
text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
|
|
1736
1738
|
}
|
|
1737
|
-
} else if ('error' ===
|
|
1739
|
+
} else if ('error' === level && 'string' == typeof message) {
|
|
1738
1740
|
let lines = message.split('\n');
|
|
1739
1741
|
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
1740
1742
|
} else text = `${message}`;
|
|
1741
|
-
|
|
1743
|
+
const method = 'error' === level || 'warn' === level ? level : 'log';
|
|
1744
|
+
console[method](label.length ? `${label} ${text}` : text, ...args);
|
|
1742
1745
|
};
|
|
1743
1746
|
let logger = {
|
|
1744
1747
|
greet: (message)=>log('log', gradient(message))
|
|
@@ -2336,6 +2339,13 @@ const ADDITIONAL_NODE_BUILTINS = [
|
|
|
2336
2339
|
/^node:/,
|
|
2337
2340
|
'pnpapi'
|
|
2338
2341
|
];
|
|
2342
|
+
const bgColor = (background, str)=>{
|
|
2343
|
+
if ([
|
|
2344
|
+
'bgRed',
|
|
2345
|
+
'bgBlack'
|
|
2346
|
+
].includes(background)) return picocolors_default()[background](picocolors_default().white(picocolors_default().bold(str)));
|
|
2347
|
+
return picocolors_default()[background](picocolors_default().blackBright(picocolors_default().bold(str)));
|
|
2348
|
+
};
|
|
2339
2349
|
const isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
|
|
2340
2350
|
const external_node_path_ = __webpack_require__("node:path");
|
|
2341
2351
|
const external_node_fs_ = __webpack_require__("node:fs");
|
|
@@ -3249,4 +3259,4 @@ const formatTestPath = (root, testFilePath)=>{
|
|
|
3249
3259
|
return prettyTestPath(testPath);
|
|
3250
3260
|
};
|
|
3251
3261
|
const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
|
|
3252
|
-
export { ADDITIONAL_NODE_BUILTINS, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, basename, castArray, clearScreen, dirname, external_node_module_createRequire, filterProjects, formatError, formatRootStr, formatTestPath, getAbsolutePath, getSetupFiles, getTaskNameWithPrefix, getTestEntries, glob, globalApis, isAbsolute, isBuiltin, isDebug, isDynamicPattern, isObject, isTTY, join, lstat, needFlagExperimentalDetectModule, node_process, normalize, pathe_M_eThtNZ_relative, posix, prettyTestPath, prettyTime, promises_stat, readdir, realpath, resolve, serializableConfig, src_logger, undoSerializableConfig, writeFile };
|
|
3262
|
+
export { ADDITIONAL_NODE_BUILTINS, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, basename, bgColor, castArray, clearScreen, dirname, external_node_module_createRequire, filterProjects, formatError, formatRootStr, formatTestPath, getAbsolutePath, getSetupFiles, getTaskNameWithPrefix, getTestEntries, glob, globalApis, isAbsolute, isBuiltin, isDebug, isDynamicPattern, isObject, isTTY, join, lstat, needFlagExperimentalDetectModule, node_process, normalize, pathe_M_eThtNZ_relative, posix, prettyTestPath, prettyTime, promises_stat, readdir, realpath, resolve, serializableConfig, src_logger, undoSerializableConfig, writeFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { config } from 'chai';
|
|
|
3
3
|
import { LoadConfigOptions } from '@rsbuild/core';
|
|
4
4
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
5
5
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
6
|
+
import type { Writable } from 'node:stream';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
@@ -519,16 +520,7 @@ declare type CoverageThreshold = {
|
|
|
519
520
|
lines?: number;
|
|
520
521
|
};
|
|
521
522
|
|
|
522
|
-
declare type CoverageThresholds = CoverageThreshold | (CoverageThreshold &
|
|
523
|
-
/** check thresholds for matched files */
|
|
524
|
-
[glob: string]: CoverageThreshold & {
|
|
525
|
-
/**
|
|
526
|
-
* check thresholds per file
|
|
527
|
-
* @default false
|
|
528
|
-
*/
|
|
529
|
-
perFile?: boolean;
|
|
530
|
-
};
|
|
531
|
-
});
|
|
523
|
+
declare type CoverageThresholds = CoverageThreshold | (CoverageThreshold & ThresholdGlobRecord);
|
|
532
524
|
|
|
533
525
|
export declare function createRstest({ config, projects, configFilePath, }: {
|
|
534
526
|
config: RstestConfig;
|
|
@@ -615,6 +607,11 @@ declare type DefaultReporterOptions = {
|
|
|
615
607
|
* @default true
|
|
616
608
|
*/
|
|
617
609
|
summary?: boolean;
|
|
610
|
+
/**
|
|
611
|
+
* logger which write messages to
|
|
612
|
+
* @default process.stdout/process.stderr
|
|
613
|
+
*/
|
|
614
|
+
logger?: Options['logger'];
|
|
618
615
|
};
|
|
619
616
|
|
|
620
617
|
/**
|
|
@@ -872,6 +869,8 @@ declare type FormattedError = {
|
|
|
872
869
|
name?: string;
|
|
873
870
|
stack?: string;
|
|
874
871
|
diff?: string;
|
|
872
|
+
expected?: string;
|
|
873
|
+
actual?: string;
|
|
875
874
|
};
|
|
876
875
|
|
|
877
876
|
declare interface Formatter {
|
|
@@ -1926,9 +1925,7 @@ declare interface Node_2 {
|
|
|
1926
1925
|
visit(visitor: Visitor, state: any): void;
|
|
1927
1926
|
}
|
|
1928
1927
|
|
|
1929
|
-
declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'exclude'>> & {
|
|
1930
|
-
[key in OptionalKeys]?: RstestConfig[key];
|
|
1931
|
-
} & {
|
|
1928
|
+
declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'exclude'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
|
|
1932
1929
|
pool: RstestPoolOptions;
|
|
1933
1930
|
coverage: NormalizedCoverageOptions;
|
|
1934
1931
|
setupFiles: string[];
|
|
@@ -1947,9 +1944,7 @@ declare type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>)
|
|
|
1947
1944
|
|
|
1948
1945
|
declare type NormalizedProcedure_2<T extends Procedure_2> = (...args: Parameters<T>) => ReturnType<T>;
|
|
1949
1946
|
|
|
1950
|
-
declare type NormalizedProjectConfig = Required<Omit<NormalizedConfig, OptionalKeys | 'projects' | 'reporters' | 'pool' | 'setupFiles'>> & {
|
|
1951
|
-
[key in OptionalKeys]?: NormalizedConfig[key];
|
|
1952
|
-
} & {
|
|
1947
|
+
declare type NormalizedProjectConfig = Required<Omit<NormalizedConfig, OptionalKeys | 'projects' | 'reporters' | 'pool' | 'setupFiles'>> & Pick<NormalizedConfig, OptionalKeys> & {
|
|
1953
1948
|
setupFiles: string[];
|
|
1954
1949
|
};
|
|
1955
1950
|
|
|
@@ -1976,6 +1971,16 @@ declare type OnTestFinishedHandler = (params: {
|
|
|
1976
1971
|
|
|
1977
1972
|
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath';
|
|
1978
1973
|
|
|
1974
|
+
declare interface Options {
|
|
1975
|
+
logger: {
|
|
1976
|
+
outputStream: Writable;
|
|
1977
|
+
errorStream: Writable;
|
|
1978
|
+
getColumns: () => number;
|
|
1979
|
+
};
|
|
1980
|
+
interval?: number;
|
|
1981
|
+
getWindow: () => string[];
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1979
1984
|
declare type OptionsReceived = PrettyFormatOptions;
|
|
1980
1985
|
|
|
1981
1986
|
declare interface ParsedStack {
|
|
@@ -2042,6 +2047,8 @@ declare type ProjectContext = {
|
|
|
2042
2047
|
environmentName: string;
|
|
2043
2048
|
/** The root path of current project. */
|
|
2044
2049
|
rootPath: string;
|
|
2050
|
+
/** Whether to output es module. */
|
|
2051
|
+
outputModule: boolean;
|
|
2045
2052
|
configFilePath?: string;
|
|
2046
2053
|
normalizedConfig: NormalizedProjectConfig;
|
|
2047
2054
|
};
|
|
@@ -2089,6 +2096,16 @@ export declare interface Reporter {
|
|
|
2089
2096
|
* Called when the test file has finished running.
|
|
2090
2097
|
*/
|
|
2091
2098
|
onTestFileResult?: (test: TestFileResult) => void;
|
|
2099
|
+
/**
|
|
2100
|
+
* Called before running the test suite.
|
|
2101
|
+
*/
|
|
2102
|
+
onTestSuiteStart?: (test: TestSuiteInfo) => void;
|
|
2103
|
+
/**
|
|
2104
|
+
* Called when the suite has finished running or was just skipped.
|
|
2105
|
+
*
|
|
2106
|
+
* `result.errors` contains only suite hooks errors
|
|
2107
|
+
*/
|
|
2108
|
+
onTestSuiteResult?: (result: TestResult) => void;
|
|
2092
2109
|
/**
|
|
2093
2110
|
* Called when the test has finished running or was just skipped.
|
|
2094
2111
|
*/
|
|
@@ -2363,7 +2380,7 @@ export declare interface RstestConfig {
|
|
|
2363
2380
|
source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
|
|
2364
2381
|
performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
|
|
2365
2382
|
dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
|
|
2366
|
-
output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath'>;
|
|
2383
|
+
output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath' | 'module'>;
|
|
2367
2384
|
resolve?: RsbuildConfig['resolve'];
|
|
2368
2385
|
tools?: Pick<NonNullable<RsbuildConfig['tools']>, 'rspack' | 'swc' | 'bundlerChain'>;
|
|
2369
2386
|
}
|
|
@@ -2758,7 +2775,7 @@ declare class StatusRenderer {
|
|
|
2758
2775
|
private renderer;
|
|
2759
2776
|
private startTime;
|
|
2760
2777
|
private testState;
|
|
2761
|
-
constructor(rootPath: string, state: RstestTestState);
|
|
2778
|
+
constructor(rootPath: string, state: RstestTestState, logger?: Options['logger']);
|
|
2762
2779
|
getContent(): string[];
|
|
2763
2780
|
onTestFileStart(): void;
|
|
2764
2781
|
onTestCaseResult(): void;
|
|
@@ -2888,6 +2905,14 @@ declare class TestStateManager {
|
|
|
2888
2905
|
reset(): void;
|
|
2889
2906
|
}
|
|
2890
2907
|
|
|
2908
|
+
export declare type TestSuiteInfo = {
|
|
2909
|
+
testId: string;
|
|
2910
|
+
name: string;
|
|
2911
|
+
parentNames?: string[];
|
|
2912
|
+
testPath: TestPath;
|
|
2913
|
+
project: string;
|
|
2914
|
+
};
|
|
2915
|
+
|
|
2891
2916
|
declare type TextLcovOptions = ProjectOptions;
|
|
2892
2917
|
|
|
2893
2918
|
declare interface TextOptions extends FileOptions {
|
|
@@ -2898,6 +2923,15 @@ declare interface TextOptions extends FileOptions {
|
|
|
2898
2923
|
|
|
2899
2924
|
declare type TextSummaryOptions = FileOptions;
|
|
2900
2925
|
|
|
2926
|
+
/** check thresholds for matched files */
|
|
2927
|
+
declare type ThresholdGlobRecord = Record<string, CoverageThreshold & {
|
|
2928
|
+
/**
|
|
2929
|
+
* check thresholds per file
|
|
2930
|
+
* @default false
|
|
2931
|
+
*/
|
|
2932
|
+
perFile?: boolean;
|
|
2933
|
+
}>;
|
|
2934
|
+
|
|
2901
2935
|
declare interface Totals {
|
|
2902
2936
|
total: number;
|
|
2903
2937
|
covered: number;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
export { afterAll, afterEach, assert, beforeAll, beforeEach, createRstest, defineConfig, defineProject, describe, expect, initCli, it, loadConfig, mergeRstestConfig, onTestFailed, onTestFinished, rs, rstest, runCLI, test } from "./
|
|
3
|
+
export { afterAll, afterEach, assert, beforeAll, beforeEach, createRstest, defineConfig, defineProject, describe, expect, initCli, it, loadConfig, mergeRstestConfig, onTestFailed, onTestFinished, rs, rstest, runCLI, test } from "./131.js";
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { config } from 'chai';
|
|
2
2
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
3
|
+
import type { Writable } from 'node:stream';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
@@ -431,16 +432,7 @@ declare type CoverageThreshold = {
|
|
|
431
432
|
lines?: number;
|
|
432
433
|
};
|
|
433
434
|
|
|
434
|
-
declare type CoverageThresholds = CoverageThreshold | (CoverageThreshold &
|
|
435
|
-
/** check thresholds for matched files */
|
|
436
|
-
[glob: string]: CoverageThreshold & {
|
|
437
|
-
/**
|
|
438
|
-
* check thresholds per file
|
|
439
|
-
* @default false
|
|
440
|
-
*/
|
|
441
|
-
perFile?: boolean;
|
|
442
|
-
};
|
|
443
|
-
});
|
|
435
|
+
declare type CoverageThresholds = CoverageThreshold | (CoverageThreshold & ThresholdGlobRecord);
|
|
444
436
|
|
|
445
437
|
declare interface CustomMatcher {
|
|
446
438
|
/**
|
|
@@ -521,6 +513,11 @@ declare type DefaultReporterOptions = {
|
|
|
521
513
|
* @default true
|
|
522
514
|
*/
|
|
523
515
|
summary?: boolean;
|
|
516
|
+
/**
|
|
517
|
+
* logger which write messages to
|
|
518
|
+
* @default process.stdout/process.stderr
|
|
519
|
+
*/
|
|
520
|
+
logger?: Options['logger'];
|
|
524
521
|
};
|
|
525
522
|
|
|
526
523
|
declare type DescribeAPI = DescribeFn & {
|
|
@@ -704,6 +701,8 @@ declare type FormattedError = {
|
|
|
704
701
|
name?: string;
|
|
705
702
|
stack?: string;
|
|
706
703
|
diff?: string;
|
|
704
|
+
expected?: string;
|
|
705
|
+
actual?: string;
|
|
707
706
|
};
|
|
708
707
|
|
|
709
708
|
declare interface Formatter {
|
|
@@ -1580,9 +1579,7 @@ declare interface Node_2 {
|
|
|
1580
1579
|
visit(visitor: Visitor, state: any): void;
|
|
1581
1580
|
}
|
|
1582
1581
|
|
|
1583
|
-
declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'exclude'>> & {
|
|
1584
|
-
[key in OptionalKeys]?: RstestConfig[key];
|
|
1585
|
-
} & {
|
|
1582
|
+
declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'exclude'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
|
|
1586
1583
|
pool: RstestPoolOptions;
|
|
1587
1584
|
coverage: NormalizedCoverageOptions;
|
|
1588
1585
|
setupFiles: string[];
|
|
@@ -1608,9 +1605,7 @@ declare type NormalizedFixtures = Record<string, NormalizedFixture>;
|
|
|
1608
1605
|
|
|
1609
1606
|
declare type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
|
|
1610
1607
|
|
|
1611
|
-
declare type NormalizedProjectConfig = Required<Omit<NormalizedConfig, OptionalKeys | 'projects' | 'reporters' | 'pool' | 'setupFiles'>> & {
|
|
1612
|
-
[key in OptionalKeys]?: NormalizedConfig[key];
|
|
1613
|
-
} & {
|
|
1608
|
+
declare type NormalizedProjectConfig = Required<Omit<NormalizedConfig, OptionalKeys | 'projects' | 'reporters' | 'pool' | 'setupFiles'>> & Pick<NormalizedConfig, OptionalKeys> & {
|
|
1614
1609
|
setupFiles: string[];
|
|
1615
1610
|
};
|
|
1616
1611
|
|
|
@@ -1633,6 +1628,16 @@ declare type OnTestFinishedHandler = (params: {
|
|
|
1633
1628
|
|
|
1634
1629
|
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath';
|
|
1635
1630
|
|
|
1631
|
+
declare interface Options {
|
|
1632
|
+
logger: {
|
|
1633
|
+
outputStream: Writable;
|
|
1634
|
+
errorStream: Writable;
|
|
1635
|
+
getColumns: () => number;
|
|
1636
|
+
};
|
|
1637
|
+
interval?: number;
|
|
1638
|
+
getWindow: () => string[];
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1636
1641
|
declare type OptionsReceived = PrettyFormatOptions;
|
|
1637
1642
|
|
|
1638
1643
|
declare interface ParsedStack {
|
|
@@ -1688,6 +1693,8 @@ declare type ProjectContext = {
|
|
|
1688
1693
|
environmentName: string;
|
|
1689
1694
|
/** The root path of current project. */
|
|
1690
1695
|
rootPath: string;
|
|
1696
|
+
/** Whether to output es module. */
|
|
1697
|
+
outputModule: boolean;
|
|
1691
1698
|
configFilePath?: string;
|
|
1692
1699
|
normalizedConfig: NormalizedProjectConfig;
|
|
1693
1700
|
};
|
|
@@ -1735,6 +1742,16 @@ declare interface Reporter {
|
|
|
1735
1742
|
* Called when the test file has finished running.
|
|
1736
1743
|
*/
|
|
1737
1744
|
onTestFileResult?: (test: TestFileResult) => void;
|
|
1745
|
+
/**
|
|
1746
|
+
* Called before running the test suite.
|
|
1747
|
+
*/
|
|
1748
|
+
onTestSuiteStart?: (test: TestSuiteInfo) => void;
|
|
1749
|
+
/**
|
|
1750
|
+
* Called when the suite has finished running or was just skipped.
|
|
1751
|
+
*
|
|
1752
|
+
* `result.errors` contains only suite hooks errors
|
|
1753
|
+
*/
|
|
1754
|
+
onTestSuiteResult?: (result: TestResult) => void;
|
|
1738
1755
|
/**
|
|
1739
1756
|
* Called when the test has finished running or was just skipped.
|
|
1740
1757
|
*/
|
|
@@ -1996,7 +2013,7 @@ declare interface RstestConfig {
|
|
|
1996
2013
|
source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
|
|
1997
2014
|
performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
|
|
1998
2015
|
dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
|
|
1999
|
-
output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath'>;
|
|
2016
|
+
output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath' | 'module'>;
|
|
2000
2017
|
resolve?: RsbuildConfig['resolve'];
|
|
2001
2018
|
tools?: Pick<NonNullable<RsbuildConfig['tools']>, 'rspack' | 'swc' | 'bundlerChain'>;
|
|
2002
2019
|
}
|
|
@@ -2087,6 +2104,8 @@ declare type RuntimeRPC = {
|
|
|
2087
2104
|
assetFiles: Record<string, string>;
|
|
2088
2105
|
sourceMaps: Record<string, string>;
|
|
2089
2106
|
}>;
|
|
2107
|
+
onTestSuiteStart: (test: TestSuiteInfo) => Promise<void>;
|
|
2108
|
+
onTestSuiteResult: (result: TestResult) => Promise<void>;
|
|
2090
2109
|
onTestCaseStart: (test: TestCaseInfo) => Promise<void>;
|
|
2091
2110
|
onTestCaseResult: (result: TestResult) => Promise<void>;
|
|
2092
2111
|
getCountOfFailedTests: () => Promise<number>;
|
|
@@ -2285,7 +2304,7 @@ declare class StatusRenderer {
|
|
|
2285
2304
|
private renderer;
|
|
2286
2305
|
private startTime;
|
|
2287
2306
|
private testState;
|
|
2288
|
-
constructor(rootPath: string, state: RstestTestState);
|
|
2307
|
+
constructor(rootPath: string, state: RstestTestState, logger?: Options['logger']);
|
|
2289
2308
|
getContent(): string[];
|
|
2290
2309
|
onTestFileStart(): void;
|
|
2291
2310
|
onTestCaseResult(): void;
|
|
@@ -2459,17 +2478,12 @@ declare class TestStateManager {
|
|
|
2459
2478
|
reset(): void;
|
|
2460
2479
|
}
|
|
2461
2480
|
|
|
2462
|
-
declare type TestSuite = {
|
|
2463
|
-
testId: string;
|
|
2464
|
-
name: string;
|
|
2465
|
-
parentNames?: string[];
|
|
2481
|
+
declare type TestSuite = TestSuiteInfo & {
|
|
2466
2482
|
runMode: TestRunMode;
|
|
2467
2483
|
each?: boolean;
|
|
2468
2484
|
inTestEach?: boolean;
|
|
2469
2485
|
concurrent?: boolean;
|
|
2470
2486
|
sequential?: boolean;
|
|
2471
|
-
testPath: TestPath;
|
|
2472
|
-
project: string;
|
|
2473
2487
|
/** nested cases and suite could in a suite */
|
|
2474
2488
|
tests: (TestSuite | TestCase)[];
|
|
2475
2489
|
type: 'suite';
|
|
@@ -2479,6 +2493,14 @@ declare type TestSuite = {
|
|
|
2479
2493
|
beforeEachListeners?: BeforeEachListener[];
|
|
2480
2494
|
};
|
|
2481
2495
|
|
|
2496
|
+
declare type TestSuiteInfo = {
|
|
2497
|
+
testId: string;
|
|
2498
|
+
name: string;
|
|
2499
|
+
parentNames?: string[];
|
|
2500
|
+
testPath: TestPath;
|
|
2501
|
+
project: string;
|
|
2502
|
+
};
|
|
2503
|
+
|
|
2482
2504
|
declare type TextLcovOptions = ProjectOptions;
|
|
2483
2505
|
|
|
2484
2506
|
declare interface TextOptions extends FileOptions {
|
|
@@ -2489,6 +2511,15 @@ declare interface TextOptions extends FileOptions {
|
|
|
2489
2511
|
|
|
2490
2512
|
declare type TextSummaryOptions = FileOptions;
|
|
2491
2513
|
|
|
2514
|
+
/** check thresholds for matched files */
|
|
2515
|
+
declare type ThresholdGlobRecord = Record<string, CoverageThreshold & {
|
|
2516
|
+
/**
|
|
2517
|
+
* check thresholds per file
|
|
2518
|
+
* @default false
|
|
2519
|
+
*/
|
|
2520
|
+
perFile?: boolean;
|
|
2521
|
+
}>;
|
|
2522
|
+
|
|
2492
2523
|
declare interface Totals {
|
|
2493
2524
|
total: number;
|
|
2494
2525
|
covered: number;
|
|
@@ -2553,6 +2584,7 @@ declare type WorkerContext = {
|
|
|
2553
2584
|
project: string;
|
|
2554
2585
|
runtimeConfig: RuntimeConfig;
|
|
2555
2586
|
taskId: number;
|
|
2587
|
+
outputModule: boolean;
|
|
2556
2588
|
};
|
|
2557
2589
|
|
|
2558
2590
|
declare type XInput = {
|
package/dist/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"chai": "^5.3.3",
|
|
55
55
|
"pathe": "^2.0.3",
|
|
56
|
-
"birpc": "2.
|
|
56
|
+
"birpc": "2.9.0",
|
|
57
57
|
"@vitest/expect": "^3.2.4",
|
|
58
58
|
"@vitest/snapshot": "^3.2.4",
|
|
59
59
|
"@babel/code-frame": "^7.27.1",
|
|
60
60
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
61
61
|
"@microsoft/api-extractor": "^7.53.3",
|
|
62
|
-
"@rslib/core": "0.
|
|
62
|
+
"@rslib/core": "0.18.3",
|
|
63
63
|
"@sinonjs/fake-timers": "^14.0.0",
|
|
64
64
|
"@types/babel__code-frame": "^7.0.6",
|
|
65
65
|
"@types/istanbul-reports": "^3.0.4",
|
|
@@ -70,12 +70,13 @@
|
|
|
70
70
|
"@types/picomatch": "^4.0.2",
|
|
71
71
|
"cac": "^6.7.14",
|
|
72
72
|
"chokidar": "^4.0.3",
|
|
73
|
-
"happy-dom": "^20.0.
|
|
73
|
+
"happy-dom": "^20.0.11",
|
|
74
74
|
"jest-diff": "^30.2.0",
|
|
75
75
|
"jsdom": "^26.1.0",
|
|
76
76
|
"webpack-license-plugin": "^4.5.1",
|
|
77
77
|
"picocolors": "^1.1.1",
|
|
78
|
-
"
|
|
78
|
+
"pretty-format": "^30.2.0",
|
|
79
|
+
"rslog": "^1.3.2",
|
|
79
80
|
"source-map-support": "^0.5.21",
|
|
80
81
|
"std-env": "^3.10.0",
|
|
81
82
|
"stacktrace-parser": "0.1.11",
|
|
@@ -107,7 +108,7 @@
|
|
|
107
108
|
"scripts": {
|
|
108
109
|
"build": "rslib build && npx prettier ./LICENSE.md --write",
|
|
109
110
|
"typecheck": "tsc --noEmit",
|
|
110
|
-
"dev": "rslib build --watch",
|
|
111
|
+
"dev": "cross-env SOURCEMAP=true rslib build --watch",
|
|
111
112
|
"test": "npx rstest --globals"
|
|
112
113
|
}
|
|
113
114
|
}
|