@rstest/core 0.1.2 → 0.2.0
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 +26 -0
- package/bin/rstest.js +1 -1
- package/dist/208.js +1 -1
- package/dist/25.js +91 -0
- package/dist/285.js +12 -9
- package/dist/355.js +1 -1
- package/dist/359.js +13 -9
- package/dist/64.js +1 -1
- package/dist/668.js +1439 -0
- package/dist/668.js.LICENSE.txt +1 -0
- package/dist/813.js +1 -1
- package/dist/854.js +72 -55
- package/dist/867.js +1 -1
- package/dist/920.js +321 -0
- package/dist/{cli.js → index.js} +688 -609
- package/dist/worker.js +11 -10
- package/dist-types/{public.d.ts → index.d.ts} +25 -17
- package/dist-types/worker.d.ts +6 -2
- package/package.json +10 -13
- package/dist/629.js +0 -84
- package/dist/node.js +0 -2
- package/dist/public.js +0 -6
- package/dist-types/cli.d.ts +0 -3
- package/dist-types/node.d.ts +0 -450
package/dist/worker.js
CHANGED
|
@@ -4900,7 +4900,7 @@ var __webpack_modules__ = {
|
|
|
4900
4900
|
},
|
|
4901
4901
|
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
4902
4902
|
const os = __webpack_require__("node:os");
|
|
4903
|
-
const tty = __webpack_require__("
|
|
4903
|
+
const tty = __webpack_require__("tty");
|
|
4904
4904
|
const hasFlag = __webpack_require__("../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js");
|
|
4905
4905
|
const { env } = process;
|
|
4906
4906
|
let forceColor;
|
|
@@ -5130,7 +5130,7 @@ var __webpack_modules__ = {
|
|
|
5130
5130
|
k: ()=>src_logger
|
|
5131
5131
|
});
|
|
5132
5132
|
var external_node_os_ = __webpack_require__("node:os");
|
|
5133
|
-
var external_node_tty_ = __webpack_require__("
|
|
5133
|
+
var external_node_tty_ = __webpack_require__("tty");
|
|
5134
5134
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
5135
5135
|
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
5136
5136
|
const position = argv.indexOf(prefix + flag);
|
|
@@ -5200,6 +5200,7 @@ var __webpack_modules__ = {
|
|
|
5200
5200
|
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
5201
5201
|
if ('truecolor' === env.COLORTERM) return 3;
|
|
5202
5202
|
if ('xterm-kitty' === env.TERM) return 3;
|
|
5203
|
+
if ('xterm-ghostty' === env.TERM) return 3;
|
|
5203
5204
|
if ('TERM_PROGRAM' in env) {
|
|
5204
5205
|
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
5205
5206
|
switch(env.TERM_PROGRAM){
|
|
@@ -5397,7 +5398,7 @@ var __webpack_modules__ = {
|
|
|
5397
5398
|
src_logger.override({
|
|
5398
5399
|
debug: (message, ...args)=>{
|
|
5399
5400
|
if ('verbose' !== src_logger.level) return;
|
|
5400
|
-
const time = helper.$_.gray(
|
|
5401
|
+
const time = helper.$_.gray(getTime());
|
|
5401
5402
|
console.log(` ${helper.$_.magenta('rstest')} ${time} ${message}`, ...args);
|
|
5402
5403
|
}
|
|
5403
5404
|
});
|
|
@@ -5417,7 +5418,7 @@ var __webpack_modules__ = {
|
|
|
5417
5418
|
"node:console": function(module) {
|
|
5418
5419
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_console_8631dfae__;
|
|
5419
5420
|
},
|
|
5420
|
-
fs: function(module) {
|
|
5421
|
+
"node:fs": function(module) {
|
|
5421
5422
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
5422
5423
|
},
|
|
5423
5424
|
"node:fs/promises": function(module) {
|
|
@@ -5432,7 +5433,7 @@ var __webpack_modules__ = {
|
|
|
5432
5433
|
"node:path": function(module) {
|
|
5433
5434
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
|
|
5434
5435
|
},
|
|
5435
|
-
|
|
5436
|
+
tty: function(module) {
|
|
5436
5437
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__;
|
|
5437
5438
|
},
|
|
5438
5439
|
"node:util": function(module) {
|
|
@@ -5576,7 +5577,7 @@ var external_node_path_ = __webpack_require__("node:path");
|
|
|
5576
5577
|
var external_pathe_ = __webpack_require__("pathe");
|
|
5577
5578
|
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
5578
5579
|
const shouldInterop = ({ interopDefault = true, modulePath, mod })=>{
|
|
5579
|
-
if (
|
|
5580
|
+
if (!interopDefault) return false;
|
|
5580
5581
|
return !modulePath.endsWith('.mjs') && 'default' in mod;
|
|
5581
5582
|
};
|
|
5582
5583
|
const isPrimitive = (v)=>v !== Object(v);
|
|
@@ -5650,7 +5651,7 @@ const createRequire = (filename, distPath, rstestContext, assetFiles, interopDef
|
|
|
5650
5651
|
return require;
|
|
5651
5652
|
};
|
|
5652
5653
|
const defineRstestDynamicImport = ({ testPath, interopDefault, returnModule = false })=>async (specifier, importAttributes)=>{
|
|
5653
|
-
const resolvedPath = (0, external_node_path_.isAbsolute)(specifier) ? pathToFileURL(specifier) :
|
|
5654
|
+
const resolvedPath = (0, external_node_path_.isAbsolute)(specifier) ? pathToFileURL(specifier) : import.meta.resolve(specifier, pathToFileURL(testPath));
|
|
5654
5655
|
const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
|
|
5655
5656
|
if (importAttributes?.with?.rstest) delete importAttributes.with.rstest;
|
|
5656
5657
|
const importedModule = await import(modulePath, importAttributes);
|
|
@@ -5762,7 +5763,7 @@ function createRuntimeRpc(options) {
|
|
|
5762
5763
|
rpc
|
|
5763
5764
|
};
|
|
5764
5765
|
}
|
|
5765
|
-
var external_node_fs_ = __webpack_require__("fs");
|
|
5766
|
+
var external_node_fs_ = __webpack_require__("node:fs");
|
|
5766
5767
|
class NodeSnapshotEnvironment {
|
|
5767
5768
|
constructor(options = {}){
|
|
5768
5769
|
this.options = options;
|
|
@@ -5885,7 +5886,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
|
|
|
5885
5886
|
{
|
|
5886
5887
|
const { environment } = await __webpack_require__.e("44").then(__webpack_require__.bind(__webpack_require__, "./src/runtime/worker/env/happyDom.ts"));
|
|
5887
5888
|
const { teardown } = await environment.setup(global, {});
|
|
5888
|
-
cleanupFns.push(async ()=>
|
|
5889
|
+
cleanupFns.push(async ()=>teardown(global));
|
|
5889
5890
|
break;
|
|
5890
5891
|
}
|
|
5891
5892
|
default:
|
|
@@ -5948,7 +5949,7 @@ const runInPool = async (options)=>{
|
|
|
5948
5949
|
isTeardown = false;
|
|
5949
5950
|
const { entryInfo: { distPath, testPath }, setupEntries, assetFiles, type, context: { runtimeConfig: { isolate } } } = options;
|
|
5950
5951
|
const cleanups = [];
|
|
5951
|
-
const exit = process.exit;
|
|
5952
|
+
const exit = process.exit.bind(process);
|
|
5952
5953
|
process.exit = (code = process.exitCode || 0)=>{
|
|
5953
5954
|
throw new Error(`process.exit unexpectedly called with "${code}"`);
|
|
5954
5955
|
};
|
|
@@ -430,13 +430,13 @@ declare type DescribeAPI = DescribeFn & {
|
|
|
430
430
|
};
|
|
431
431
|
|
|
432
432
|
declare interface DescribeEachFn {
|
|
433
|
-
<T extends Record<string, unknown>>(cases:
|
|
434
|
-
<T extends readonly [unknown, ...
|
|
433
|
+
<T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>) => void;
|
|
434
|
+
<T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>) => void;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
declare type DescribeFn = (description: string, fn?: () => void) => void;
|
|
438
438
|
|
|
439
|
-
declare type DescribeForFn = <T>(cases:
|
|
439
|
+
declare type DescribeForFn = <T>(cases: readonly T[]) => (description: string, fn?: (param: T) => MaybePromise<void>) => void;
|
|
440
440
|
|
|
441
441
|
/**
|
|
442
442
|
* @param a Expected value
|
|
@@ -514,7 +514,7 @@ declare interface ExpectStatic extends ExpectStatic_2 {
|
|
|
514
514
|
unreachable: (message?: string) => never;
|
|
515
515
|
soft: <T>(actual: T, message?: string) => Assertion<T>;
|
|
516
516
|
poll: <T>(actual: () => T, options?: ExpectPollOptions) => Omit<PromisifyAssertion_2<Awaited<T>>, 'rejects' | 'resolves' | 'toThrow' | 'toThrowError' | 'throw' | 'throws' | 'matchSnapshot' | 'toMatchSnapshot' | 'toMatchInlineSnapshot' | 'toThrowErrorMatchingSnapshot' | 'toThrowErrorMatchingInlineSnapshot'>;
|
|
517
|
-
addEqualityTesters: (testers:
|
|
517
|
+
addEqualityTesters: (testers: Tester[]) => void;
|
|
518
518
|
assertions: (expected: number) => void;
|
|
519
519
|
hasAssertions: () => void;
|
|
520
520
|
addSnapshotSerializer: typeof addSerializer;
|
|
@@ -1107,6 +1107,8 @@ declare interface MatcherState_2 extends MatcherState {
|
|
|
1107
1107
|
|
|
1108
1108
|
declare type MaybePromise<T> = T | Promise<T>;
|
|
1109
1109
|
|
|
1110
|
+
export declare const mergeRstestConfig: (...configs: RstestConfig[]) => RstestConfig;
|
|
1111
|
+
|
|
1110
1112
|
export declare interface Mock<T extends FunctionLike = FunctionLike> extends MockInstance_2<T> {
|
|
1111
1113
|
new (...args: Parameters<T>): ReturnType<T>;
|
|
1112
1114
|
(...args: Parameters<T>): ReturnType<T>;
|
|
@@ -1225,21 +1227,21 @@ declare type MockContext_2<T extends FunctionLike = FunctionLike> = {
|
|
|
1225
1227
|
/**
|
|
1226
1228
|
* List of the call arguments of all calls that have been made to the mock.
|
|
1227
1229
|
*/
|
|
1228
|
-
calls:
|
|
1230
|
+
calls: Parameters<T>[];
|
|
1229
1231
|
/**
|
|
1230
1232
|
* List of all the object instances that have been instantiated from the mock.
|
|
1231
1233
|
*/
|
|
1232
|
-
instances:
|
|
1234
|
+
instances: ReturnType<T>[];
|
|
1233
1235
|
/**
|
|
1234
1236
|
* List of all the function contexts that have been applied to calls to the mock.
|
|
1235
1237
|
*/
|
|
1236
|
-
contexts:
|
|
1238
|
+
contexts: ThisParameterType<T>[];
|
|
1237
1239
|
/**
|
|
1238
1240
|
* The order of mock's execution.
|
|
1239
1241
|
* This returns an array of numbers which are shared between all defined mocks.
|
|
1240
1242
|
* The index is starting with `1`.
|
|
1241
1243
|
*/
|
|
1242
|
-
invocationCallOrder:
|
|
1244
|
+
invocationCallOrder: number[];
|
|
1243
1245
|
/**
|
|
1244
1246
|
* List of the call arguments of the last call that was made to the mock.
|
|
1245
1247
|
* If the function was not called, it will return `undefined`.
|
|
@@ -1248,7 +1250,7 @@ declare type MockContext_2<T extends FunctionLike = FunctionLike> = {
|
|
|
1248
1250
|
/**
|
|
1249
1251
|
* List of the results of all calls that have been made to the mock.
|
|
1250
1252
|
*/
|
|
1251
|
-
results:
|
|
1253
|
+
results: MockResult_2<ReturnType<T>>[];
|
|
1252
1254
|
/**
|
|
1253
1255
|
* List of the results of all values that were `resolved` or `rejected` from the function.
|
|
1254
1256
|
*/
|
|
@@ -1650,7 +1652,7 @@ declare interface RawSnapshotInfo {
|
|
|
1650
1652
|
|
|
1651
1653
|
declare type Refs = Array<unknown>;
|
|
1652
1654
|
|
|
1653
|
-
declare interface Reporter {
|
|
1655
|
+
export declare interface Reporter {
|
|
1654
1656
|
/**
|
|
1655
1657
|
* Called before test file run.
|
|
1656
1658
|
*/
|
|
@@ -1710,7 +1712,7 @@ declare type Rstest = RunnerAPI & {
|
|
|
1710
1712
|
|
|
1711
1713
|
export declare const rstest: RstestUtilities;
|
|
1712
1714
|
|
|
1713
|
-
declare type RstestCommand = 'watch' | 'run' | 'list';
|
|
1715
|
+
export declare type RstestCommand = 'watch' | 'run' | 'list';
|
|
1714
1716
|
|
|
1715
1717
|
export declare interface RstestConfig {
|
|
1716
1718
|
/**
|
|
@@ -1880,6 +1882,10 @@ declare type RstestContext = {
|
|
|
1880
1882
|
originalConfig: Readonly<RstestConfig>;
|
|
1881
1883
|
/** The normalized Rstest config. */
|
|
1882
1884
|
normalizedConfig: NormalizedConfig;
|
|
1885
|
+
/** filter by a filename regex pattern */
|
|
1886
|
+
fileFilters?: string[];
|
|
1887
|
+
/** The config file path. */
|
|
1888
|
+
configFilePath?: string;
|
|
1883
1889
|
/**
|
|
1884
1890
|
* The command type.
|
|
1885
1891
|
*
|
|
@@ -2030,6 +2036,8 @@ declare interface RstestUtilities {
|
|
|
2030
2036
|
clearAllTimers: () => RstestUtilities;
|
|
2031
2037
|
}
|
|
2032
2038
|
|
|
2039
|
+
export declare function runCLI(): Promise<void>;
|
|
2040
|
+
|
|
2033
2041
|
declare type RunnerAPI = {
|
|
2034
2042
|
describe: DescribeAPI;
|
|
2035
2043
|
it: TestAPIs;
|
|
@@ -2270,8 +2278,8 @@ declare type TestContext = {
|
|
|
2270
2278
|
};
|
|
2271
2279
|
|
|
2272
2280
|
declare interface TestEachFn {
|
|
2273
|
-
<T extends Record<string, unknown>>(cases:
|
|
2274
|
-
<T extends readonly [unknown, ...
|
|
2281
|
+
<T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>, timeout?: number) => void;
|
|
2282
|
+
<T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>, timeout?: number) => void;
|
|
2275
2283
|
}
|
|
2276
2284
|
|
|
2277
2285
|
declare type Tester = (this: TesterContext, a: any, b: any, customTesters: Array<Tester>) => boolean | undefined;
|
|
@@ -2280,23 +2288,23 @@ declare interface TesterContext {
|
|
|
2280
2288
|
equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
|
|
2281
2289
|
}
|
|
2282
2290
|
|
|
2283
|
-
declare type TestFileInfo = {
|
|
2291
|
+
export declare type TestFileInfo = {
|
|
2284
2292
|
testPath: TestPath;
|
|
2285
2293
|
};
|
|
2286
2294
|
|
|
2287
|
-
declare type TestFileResult = TestResult & {
|
|
2295
|
+
export declare type TestFileResult = TestResult & {
|
|
2288
2296
|
results: TestResult[];
|
|
2289
2297
|
snapshotResult?: SnapshotResult;
|
|
2290
2298
|
};
|
|
2291
2299
|
|
|
2292
2300
|
declare type TestFn<ExtraContext = object> = (description: string, fn?: TestCallbackFn<ExtraContext>, timeout?: number) => void;
|
|
2293
2301
|
|
|
2294
|
-
declare type TestForFn<ExtraContext = object> = <T>(cases:
|
|
2302
|
+
declare type TestForFn<ExtraContext = object> = <T>(cases: readonly T[]) => (description: string, fn?: (param: T, context: TestContext & ExtraContext) => MaybePromise<void>, timeout?: number) => void;
|
|
2295
2303
|
|
|
2296
2304
|
/** The test file original path */
|
|
2297
2305
|
declare type TestPath = string;
|
|
2298
2306
|
|
|
2299
|
-
declare type TestResult = {
|
|
2307
|
+
export declare type TestResult = {
|
|
2300
2308
|
status: TestResultStatus;
|
|
2301
2309
|
name: string;
|
|
2302
2310
|
testPath: TestPath;
|
package/dist-types/worker.d.ts
CHANGED
|
@@ -475,7 +475,7 @@ declare interface ExpectStatic extends ExpectStatic_2 {
|
|
|
475
475
|
unreachable: (message?: string) => never;
|
|
476
476
|
soft: <T>(actual: T, message?: string) => Assertion_2<T>;
|
|
477
477
|
poll: <T>(actual: () => T, options?: ExpectPollOptions) => Omit<PromisifyAssertion_2<Awaited<T>>, 'rejects' | 'resolves' | 'toThrow' | 'toThrowError' | 'throw' | 'throws' | 'matchSnapshot' | 'toMatchSnapshot' | 'toMatchInlineSnapshot' | 'toThrowErrorMatchingSnapshot' | 'toThrowErrorMatchingInlineSnapshot'>;
|
|
478
|
-
addEqualityTesters: (testers:
|
|
478
|
+
addEqualityTesters: (testers: Tester[]) => void;
|
|
479
479
|
assertions: (expected: number) => void;
|
|
480
480
|
hasAssertions: () => void;
|
|
481
481
|
addSnapshotSerializer: typeof addSerializer;
|
|
@@ -1616,6 +1616,10 @@ declare type RstestContext = {
|
|
|
1616
1616
|
originalConfig: Readonly<RstestConfig>;
|
|
1617
1617
|
/** The normalized Rstest config. */
|
|
1618
1618
|
normalizedConfig: NormalizedConfig;
|
|
1619
|
+
/** filter by a filename regex pattern */
|
|
1620
|
+
fileFilters?: string[];
|
|
1621
|
+
/** The config file path. */
|
|
1622
|
+
configFilePath?: string;
|
|
1619
1623
|
/**
|
|
1620
1624
|
* The command type.
|
|
1621
1625
|
*
|
|
@@ -1962,7 +1966,7 @@ declare type TestSuite = {
|
|
|
1962
1966
|
sequential?: boolean;
|
|
1963
1967
|
testPath: TestPath;
|
|
1964
1968
|
/** nested cases and suite could in a suite */
|
|
1965
|
-
tests:
|
|
1969
|
+
tests: (TestSuite | TestCase)[];
|
|
1966
1970
|
type: 'suite';
|
|
1967
1971
|
afterAllListeners?: AfterAllListener[];
|
|
1968
1972
|
beforeAllListeners?: BeforeAllListener[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -18,19 +18,15 @@
|
|
|
18
18
|
],
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"type": "module",
|
|
21
|
-
"main": "./dist/
|
|
22
|
-
"types": "./dist-types/
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"types": "./dist-types/index.d.ts",
|
|
23
23
|
"bin": {
|
|
24
24
|
"rstest": "./bin/rstest.js"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
28
|
-
"types": "./dist-types/
|
|
29
|
-
"default": "./dist/
|
|
30
|
-
},
|
|
31
|
-
"./node": {
|
|
32
|
-
"types": "./dist-types/node.d.ts",
|
|
33
|
-
"default": "./dist/node.js"
|
|
28
|
+
"types": "./dist-types/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
34
30
|
},
|
|
35
31
|
"./globals": {
|
|
36
32
|
"types": "./globals.d.ts"
|
|
@@ -50,7 +46,7 @@
|
|
|
50
46
|
"dependencies": {
|
|
51
47
|
"chai": "^5.2.1",
|
|
52
48
|
"@types/chai": "^5.2.2",
|
|
53
|
-
"@rsbuild/core": "1.4.
|
|
49
|
+
"@rsbuild/core": "1.4.15",
|
|
54
50
|
"birpc": "2.5.0",
|
|
55
51
|
"pathe": "^2.0.3",
|
|
56
52
|
"std-env": "^3.9.0",
|
|
@@ -62,19 +58,20 @@
|
|
|
62
58
|
"@babel/code-frame": "^7.27.1",
|
|
63
59
|
"@jridgewell/trace-mapping": "0.3.29",
|
|
64
60
|
"@microsoft/api-extractor": "^7.52.10",
|
|
65
|
-
"@rslib/core": "0.11.
|
|
61
|
+
"@rslib/core": "0.11.2",
|
|
66
62
|
"@sinonjs/fake-timers": "^14.0.0",
|
|
67
63
|
"@types/babel__code-frame": "^7.0.6",
|
|
68
64
|
"@types/jsdom": "^21.1.7",
|
|
69
65
|
"@types/sinonjs__fake-timers": "^8.1.5",
|
|
70
66
|
"@types/source-map-support": "^0.5.10",
|
|
71
67
|
"cac": "^6.7.14",
|
|
68
|
+
"chokidar": "^4.0.3",
|
|
72
69
|
"happy-dom": "^18.0.1",
|
|
73
70
|
"jest-diff": "^30.0.5",
|
|
74
71
|
"jsdom": "^26.1.0",
|
|
75
72
|
"license-webpack-plugin": "^4.0.2",
|
|
76
73
|
"picocolors": "^1.1.1",
|
|
77
|
-
"rslog": "^1.2.
|
|
74
|
+
"rslog": "^1.2.11",
|
|
78
75
|
"source-map-support": "^0.5.21",
|
|
79
76
|
"stacktrace-parser": "0.1.11",
|
|
80
77
|
"tinyglobby": "^0.2.14",
|
|
@@ -94,7 +91,7 @@
|
|
|
94
91
|
}
|
|
95
92
|
},
|
|
96
93
|
"engines": {
|
|
97
|
-
"node": ">=18.
|
|
94
|
+
"node": ">=18.12.0"
|
|
98
95
|
},
|
|
99
96
|
"publishConfig": {
|
|
100
97
|
"access": "public",
|
package/dist/629.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import 'module';
|
|
2
|
-
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
export const __webpack_ids__ = [
|
|
4
|
-
"629"
|
|
5
|
-
];
|
|
6
|
-
export const __webpack_modules__ = {
|
|
7
|
-
"./src/core/runTests.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
runTests: ()=>runTests
|
|
10
|
-
});
|
|
11
|
-
var _pool__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/pool/index.ts");
|
|
12
|
-
var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/index.ts");
|
|
13
|
-
var _rsbuild__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/core/rsbuild.ts");
|
|
14
|
-
async function runTests(context, fileFilters) {
|
|
15
|
-
const { normalizedConfig: { include, exclude, root, name, setupFiles: setups, includeSource }, rootPath, reporters, snapshotManager, command } = context;
|
|
16
|
-
const globTestSourceEntries = async ()=>{
|
|
17
|
-
const entries = await (0, _utils__WEBPACK_IMPORTED_MODULE_1__.GL)({
|
|
18
|
-
include,
|
|
19
|
-
exclude,
|
|
20
|
-
includeSource,
|
|
21
|
-
root,
|
|
22
|
-
fileFilters
|
|
23
|
-
});
|
|
24
|
-
if (!Object.keys(entries).length) {
|
|
25
|
-
_utils__WEBPACK_IMPORTED_MODULE_1__.kg.log(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.red('No test files found.'));
|
|
26
|
-
_utils__WEBPACK_IMPORTED_MODULE_1__.kg.log('');
|
|
27
|
-
if (fileFilters.length) _utils__WEBPACK_IMPORTED_MODULE_1__.kg.log(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.gray('filter: '), fileFilters.join(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.gray(', ')));
|
|
28
|
-
_utils__WEBPACK_IMPORTED_MODULE_1__.kg.log(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.gray('include:'), include.join(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.gray(', ')));
|
|
29
|
-
_utils__WEBPACK_IMPORTED_MODULE_1__.kg.log(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.gray('exclude:'), exclude.join(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.gray(', ')));
|
|
30
|
-
_utils__WEBPACK_IMPORTED_MODULE_1__.kg.log('');
|
|
31
|
-
}
|
|
32
|
-
return entries;
|
|
33
|
-
};
|
|
34
|
-
const setupFiles = (0, _utils__WEBPACK_IMPORTED_MODULE_1__.aA)(setups, rootPath);
|
|
35
|
-
const rsbuildInstance = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_2__.z)(context, globTestSourceEntries, setupFiles);
|
|
36
|
-
const getRsbuildStats = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_2__.r)({
|
|
37
|
-
name,
|
|
38
|
-
normalizedConfig: context.normalizedConfig,
|
|
39
|
-
globTestSourceEntries,
|
|
40
|
-
setupFiles,
|
|
41
|
-
rsbuildInstance,
|
|
42
|
-
rootPath
|
|
43
|
-
});
|
|
44
|
-
const run = async ()=>{
|
|
45
|
-
const { entries, setupEntries, assetFiles, sourceMaps, getSourcemap, close, buildTime } = await getRsbuildStats();
|
|
46
|
-
const testStart = Date.now();
|
|
47
|
-
const pool = await (0, _pool__WEBPACK_IMPORTED_MODULE_0__.K)({
|
|
48
|
-
entries,
|
|
49
|
-
sourceMaps,
|
|
50
|
-
setupEntries,
|
|
51
|
-
assetFiles,
|
|
52
|
-
context
|
|
53
|
-
});
|
|
54
|
-
const { results, testResults } = await pool.runTests();
|
|
55
|
-
const testTime = Date.now() - testStart;
|
|
56
|
-
const duration = {
|
|
57
|
-
totalTime: testTime + buildTime,
|
|
58
|
-
buildTime,
|
|
59
|
-
testTime
|
|
60
|
-
};
|
|
61
|
-
if (results.some((r)=>'fail' === r.status)) process.exitCode = 1;
|
|
62
|
-
for (const reporter of reporters)await reporter.onTestRunEnd?.({
|
|
63
|
-
results,
|
|
64
|
-
testResults,
|
|
65
|
-
snapshotSummary: snapshotManager.summary,
|
|
66
|
-
duration,
|
|
67
|
-
getSourcemap
|
|
68
|
-
});
|
|
69
|
-
return async ()=>{
|
|
70
|
-
await close();
|
|
71
|
-
await pool.close();
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
if ('watch' === command) rsbuildInstance.onDevCompileDone(async ()=>{
|
|
75
|
-
await run();
|
|
76
|
-
_utils__WEBPACK_IMPORTED_MODULE_1__.kg.log(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.green(' Waiting for file changes...'));
|
|
77
|
-
});
|
|
78
|
-
else {
|
|
79
|
-
const close = await run();
|
|
80
|
-
await close();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
};
|
package/dist/node.js
DELETED
package/dist/public.js
DELETED
package/dist-types/cli.d.ts
DELETED