@rspack-canary/test-tools 1.5.9-canary-bddc650e-20251012024608 → 1.5.9-canary-e259bc79-20251014173821
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/dist/case/builtin.js +0 -22
- package/dist/case/common.js +5 -1
- package/dist/case/error.js +1 -1
- package/dist/case/hook.js +2 -2
- package/dist/case/hot-step.d.ts +1 -1
- package/dist/case/hot-step.js +12 -10
- package/dist/case/hot.d.ts +5 -4
- package/dist/case/hot.js +32 -41
- package/dist/case/incremental.d.ts +1 -1
- package/dist/case/incremental.js +8 -6
- package/dist/case/normal.js +1 -5
- package/dist/case/watch.js +0 -7
- package/dist/compare/compare.js +6 -3
- package/dist/helper/expect/placeholder.js +7 -7
- package/dist/helper/expect/to-match-file-snapshot.d.ts +0 -1
- package/dist/helper/hot-update/plugin.d.ts +1 -1
- package/dist/helper/hot-update/plugin.js +4 -4
- package/dist/helper/legacy/update.d.ts +2 -0
- package/dist/helper/legacy/update.esm.d.ts +1 -0
- package/dist/helper/legacy/update.esm.js +23 -0
- package/dist/helper/legacy/update.js +19 -0
- package/dist/helper/util/checkStats.d.ts +0 -1
- package/dist/helper/util/checkStats.js +0 -18
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/jest/ignore-snapshot-default-reporter.d.ts +2 -0
- package/dist/jest/ignore-snapshot-default-reporter.js +57 -0
- package/dist/jest/ignore-snapshot-summary-reporter.d.ts +2 -0
- package/dist/jest/ignore-snapshot-summary-reporter.js +24 -0
- package/dist/jest/patch-node-env.d.ts +5 -0
- package/dist/jest/patch-node-env.js +18 -0
- package/dist/jest/slash.d.ts +2 -0
- package/dist/jest/slash.js +16 -0
- package/dist/runner/node/index.js +4 -0
- package/dist/runner/web/fake.js +6 -3
- package/dist/runner/web/jsdom.js +0 -4
- package/dist/type.d.ts +8 -0
- package/package.json +8 -5
- package/dist/helper/legacy/createLogger.d.ts +0 -23
- package/dist/helper/legacy/createLogger.js +0 -20
- package/dist/helper/legacy/diffStats.d.ts +0 -2
- package/dist/helper/legacy/diffStats.js +0 -13
- package/dist/helper/legacy/supportsBlob.d.ts +0 -2
- package/dist/helper/legacy/supportsBlob.js +0 -10
- package/dist/helper/legacy/supportsClassFields.d.ts +0 -2
- package/dist/helper/legacy/supportsClassFields.js +0 -11
- package/dist/helper/legacy/supportsES6.d.ts +0 -2
- package/dist/helper/legacy/supportsES6.js +0 -11
- package/dist/helper/legacy/supportsForOf.d.ts +0 -2
- package/dist/helper/legacy/supportsForOf.js +0 -11
- package/dist/helper/legacy/supportsIteratorDestructuring.d.ts +0 -2
- package/dist/helper/legacy/supportsIteratorDestructuring.js +0 -11
- package/dist/helper/legacy/supportsLogicalAssignment.d.ts +0 -2
- package/dist/helper/legacy/supportsLogicalAssignment.js +0 -11
- package/dist/helper/legacy/supportsObjectDestructuring.d.ts +0 -2
- package/dist/helper/legacy/supportsObjectDestructuring.js +0 -11
- package/dist/helper/legacy/supportsOptionalCatchBinding.d.ts +0 -2
- package/dist/helper/legacy/supportsOptionalCatchBinding.js +0 -11
- package/dist/helper/legacy/supportsOptionalChaining.d.ts +0 -2
- package/dist/helper/legacy/supportsOptionalChaining.js +0 -11
- package/dist/helper/legacy/supportsRequireInModule.d.ts +0 -2
- package/dist/helper/legacy/supportsRequireInModule.js +0 -5
- package/dist/helper/legacy/supportsResponse.d.ts +0 -2
- package/dist/helper/legacy/supportsResponse.js +0 -10
- package/dist/helper/legacy/supportsSpread.d.ts +0 -2
- package/dist/helper/legacy/supportsSpread.js +0 -12
- package/dist/helper/legacy/supportsTemplateStrings.d.ts +0 -2
- package/dist/helper/legacy/supportsTemplateStrings.js +0 -11
- package/dist/helper/legacy/supportsWebAssembly.d.ts +0 -2
- package/dist/helper/legacy/supportsWebAssembly.js +0 -10
- package/dist/helper/legacy/supportsWorker.d.ts +0 -2
- package/dist/helper/legacy/supportsWorker.js +0 -17
- package/dist/helper/legacy/warmup-webpack.d.ts +0 -1
- package/dist/helper/legacy/warmup-webpack.js +0 -26
- package/dist/helper/loaders/hot-update.d.ts +0 -1
- package/dist/helper/loaders/hot-update.js +0 -43
- package/dist/helper/plugins/hot-update.d.ts +0 -7
- package/dist/helper/plugins/hot-update.js +0 -40
- package/dist/helper/plugins/index.d.ts +0 -1
- package/dist/helper/plugins/index.js +0 -17
- package/dist/helper/util/currentWatchStep.d.ts +0 -1
- package/dist/helper/util/currentWatchStep.js +0 -2
- package/dist/helper/util/identifier.d.ts +0 -76
- package/dist/helper/util/identifier.js +0 -339
- package/dist/helper/util/replaceMitteDiagnostic.d.ts +0 -2
- package/dist/helper/util/replaceMitteDiagnostic.js +0 -17
- package/dist/reporter/diff-html.d.ts +0 -15
- package/dist/reporter/diff-html.js +0 -69
- package/dist/reporter/diff-stats.d.ts +0 -24
- package/dist/reporter/diff-stats.js +0 -131
- package/dist/reporter/index.d.ts +0 -2
- package/dist/reporter/index.js +0 -18
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
const { DefaultReporter } = require("@jest/reporters");
|
|
4
|
+
const chalk = require.cache[require.resolve("@jest/reporters")].require("chalk");
|
|
5
|
+
const jestUtil = require.cache[require.resolve("@jest/reporters")].require("jest-util");
|
|
6
|
+
const ARROW = " \u203A ";
|
|
7
|
+
const DOT = " \u2022 ";
|
|
8
|
+
const FAIL_COLOR = chalk.bold.red;
|
|
9
|
+
const SNAPSHOT_ADDED = chalk.bold.green;
|
|
10
|
+
const SNAPSHOT_UPDATED = chalk.bold.green;
|
|
11
|
+
const SNAPSHOT_OUTDATED = chalk.bold.yellow;
|
|
12
|
+
function getSnapshotStatus(snapshot, afterUpdate) {
|
|
13
|
+
const statuses = [];
|
|
14
|
+
if (snapshot.added) {
|
|
15
|
+
statuses.push(SNAPSHOT_ADDED(`${ARROW + jestUtil.pluralize("snapshot", snapshot.added)} written.`));
|
|
16
|
+
}
|
|
17
|
+
if (snapshot.updated) {
|
|
18
|
+
statuses.push(SNAPSHOT_UPDATED(`${ARROW + jestUtil.pluralize("snapshot", snapshot.updated)} updated.`));
|
|
19
|
+
}
|
|
20
|
+
if (snapshot.unmatched) {
|
|
21
|
+
statuses.push(FAIL_COLOR(`${ARROW + jestUtil.pluralize("snapshot", snapshot.unmatched)} failed.`));
|
|
22
|
+
}
|
|
23
|
+
if (snapshot.unchecked) {
|
|
24
|
+
if (afterUpdate) {
|
|
25
|
+
statuses.push(SNAPSHOT_UPDATED(`${ARROW + jestUtil.pluralize("snapshot", snapshot.unchecked)} removed.`));
|
|
26
|
+
for (const key of snapshot.uncheckedKeys) {
|
|
27
|
+
statuses.push(` ${DOT}${key}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
statuses.push(`${SNAPSHOT_OUTDATED(`${ARROW + jestUtil.pluralize("snapshot", snapshot.unchecked)} obsolete`)}.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (snapshot.fileDeleted) {
|
|
35
|
+
statuses.push(SNAPSHOT_UPDATED(`${ARROW}snapshot file removed.`));
|
|
36
|
+
}
|
|
37
|
+
return statuses;
|
|
38
|
+
}
|
|
39
|
+
const isUpdate = process.argv.includes("-u") || process.argv.includes("--updateSnapshot");
|
|
40
|
+
const isFiltering = process.argv.includes("-t") || process.argv.includes("--testNamePattern");
|
|
41
|
+
const isVerbose = process.argv.includes("--verbose");
|
|
42
|
+
if (!isVerbose && !isUpdate && isFiltering) {
|
|
43
|
+
class IgnoreSnapshotDefaultReporter extends DefaultReporter {
|
|
44
|
+
printTestFileFailureMessage(_testPath, _config, result) {
|
|
45
|
+
if (result.failureMessage) {
|
|
46
|
+
this.log(result.failureMessage);
|
|
47
|
+
}
|
|
48
|
+
const didUpdate = this._globalConfig.updateSnapshot === "all";
|
|
49
|
+
const snapshotStatuses = getSnapshotStatus(result.snapshot, didUpdate);
|
|
50
|
+
snapshotStatuses.forEach(this.log);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
module.exports = IgnoreSnapshotDefaultReporter;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
module.exports = DefaultReporter;
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
const { SummaryReporter } = require("@jest/reporters");
|
|
4
|
+
const chalk = require.cache[require.resolve("@jest/reporters")].require("chalk");
|
|
5
|
+
const isUpdate = process.argv.includes("-u") || process.argv.includes("--updateSnapshot");
|
|
6
|
+
const isFiltering = process.argv.includes("-t") || process.argv.includes("--testNamePattern");
|
|
7
|
+
const isVerbose = process.argv.includes("--verbose");
|
|
8
|
+
if (!isVerbose && !isUpdate && isFiltering) {
|
|
9
|
+
class IgnoreSnapshotSummaryReporter extends SummaryReporter {
|
|
10
|
+
_printSnapshotSummary(snapshots, globalConfig) {
|
|
11
|
+
if (snapshots.added ||
|
|
12
|
+
snapshots.filesRemoved ||
|
|
13
|
+
snapshots.unchecked ||
|
|
14
|
+
snapshots.unmatched ||
|
|
15
|
+
snapshots.updated) {
|
|
16
|
+
this.log(chalk.bold.yellow("Some snapshots are obsoleted, flush with `npm run test -- -u` if necessary.\n"));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
module.exports = IgnoreSnapshotSummaryReporter;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
module.exports = SummaryReporter;
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// Copied from <https://github.com/webpack/webpack/blob/main/test/patch-node-env.js>
|
|
4
|
+
//
|
|
5
|
+
const NodeEnvironment =
|
|
6
|
+
// For jest@29
|
|
7
|
+
require("jest-environment-node").TestEnvironment ||
|
|
8
|
+
// For jest@27
|
|
9
|
+
require("jest-environment-node");
|
|
10
|
+
class CustomEnvironment extends NodeEnvironment {
|
|
11
|
+
// Workaround for `Symbol('JEST_STATE_SYMBOL')`
|
|
12
|
+
async handleTestEvent(event, state) {
|
|
13
|
+
if (!this.global.JEST_STATE_SYMBOL) {
|
|
14
|
+
this.global.JEST_STATE_SYMBOL = state;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
module.exports = CustomEnvironment;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* The following code is copied from
|
|
5
|
+
* https://github.com/sindresorhus/slash/blob/98b618f5a3bfcb5dd374b204868818845b87bb2f/index.js
|
|
6
|
+
*
|
|
7
|
+
* MIT Licensed
|
|
8
|
+
* Author Sindre Sorhus @sindresorhus
|
|
9
|
+
*/
|
|
10
|
+
module.exports = function slash(path) {
|
|
11
|
+
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
12
|
+
if (isExtendedLengthPath) {
|
|
13
|
+
return path;
|
|
14
|
+
}
|
|
15
|
+
return path.replace(/\\/g, "/");
|
|
16
|
+
};
|
|
@@ -42,6 +42,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
42
42
|
const node_url_1 = require("node:url");
|
|
43
43
|
const node_vm_1 = __importStar(require("node:vm"));
|
|
44
44
|
const asModule_1 = __importDefault(require("../../helper/legacy/asModule"));
|
|
45
|
+
const createFakeWorker_1 = __importDefault(require("../../helper/legacy/createFakeWorker"));
|
|
45
46
|
const urlToRelativePath_1 = __importDefault(require("../../helper/legacy/urlToRelativePath"));
|
|
46
47
|
const type_1 = require("../../type");
|
|
47
48
|
const isRelativePath = (p) => /^\.\.?\//.test(p);
|
|
@@ -165,6 +166,9 @@ class NodeRunner {
|
|
|
165
166
|
setImmediate,
|
|
166
167
|
__MODE__: this._options.compilerOptions.mode,
|
|
167
168
|
__SNAPSHOT__: node_path_1.default.join(this._options.source, "__snapshot__"),
|
|
169
|
+
Worker: (0, createFakeWorker_1.default)(this._options.env, {
|
|
170
|
+
outputDirectory: this._options.dist
|
|
171
|
+
}),
|
|
168
172
|
...this._options.env
|
|
169
173
|
};
|
|
170
174
|
return baseModuleScope;
|
package/dist/runner/web/fake.js
CHANGED
|
@@ -102,9 +102,6 @@ class FakeDocumentWebRunner extends node_1.NodeRunner {
|
|
|
102
102
|
this.requirers.get("entry")(this._options.dist, (0, urlToRelativePath_1.default)(url));
|
|
103
103
|
};
|
|
104
104
|
globalContext.document = this.document;
|
|
105
|
-
globalContext.Worker = (0, createFakeWorker_1.default)(this._options.env, {
|
|
106
|
-
outputDirectory: this._options.dist
|
|
107
|
-
});
|
|
108
105
|
globalContext.EventSource = EventSourceForNode_1.default;
|
|
109
106
|
globalContext.location = {
|
|
110
107
|
href: "https://test.cases/path/index.html",
|
|
@@ -169,6 +166,12 @@ class FakeDocumentWebRunner extends node_1.NodeRunner {
|
|
|
169
166
|
if (!file) {
|
|
170
167
|
return this.requirers.get("miss")(currentDirectory, modulePath);
|
|
171
168
|
}
|
|
169
|
+
if (file.content.includes("__STATS_I__")) {
|
|
170
|
+
const statsIndex = this._options.stats?.()?.__index__;
|
|
171
|
+
if (typeof statsIndex === "number") {
|
|
172
|
+
esmContext.__STATS_I__ = statsIndex;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
172
175
|
let esm = esmCache.get(file.path);
|
|
173
176
|
if (!esm) {
|
|
174
177
|
esm = new node_vm_1.SourceTextModule(file.content, {
|
package/dist/runner/web/jsdom.js
CHANGED
|
@@ -8,7 +8,6 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const jsdom_1 = require("jsdom");
|
|
10
10
|
const helper_1 = require("../../helper");
|
|
11
|
-
const createFakeWorker_1 = __importDefault(require("../../helper/legacy/createFakeWorker"));
|
|
12
11
|
const EventSourceForNode_1 = __importDefault(require("../../helper/legacy/EventSourceForNode"));
|
|
13
12
|
const urlToRelativePath_1 = __importDefault(require("../../helper/legacy/urlToRelativePath"));
|
|
14
13
|
const node_1 = require("../node");
|
|
@@ -110,9 +109,6 @@ class JSDOMWebRunner extends node_1.NodeRunner {
|
|
|
110
109
|
createBaseModuleScope() {
|
|
111
110
|
const moduleScope = super.createBaseModuleScope();
|
|
112
111
|
moduleScope.EventSource = EventSourceForNode_1.default;
|
|
113
|
-
moduleScope.Worker = (0, createFakeWorker_1.default)(this._options.env, {
|
|
114
|
-
outputDirectory: this._options.dist
|
|
115
|
-
});
|
|
116
112
|
const urlToPath = (url) => {
|
|
117
113
|
return node_path_1.default.resolve(this._webOptions.dist, `./${url.startsWith("https://test.cases/path/") ? url.slice(24) : url}`);
|
|
118
114
|
};
|
package/dist/type.d.ts
CHANGED
|
@@ -201,3 +201,11 @@ export type TTestRunnerCreator = {
|
|
|
201
201
|
key: (context: ITestContext, name: string, file: string) => string;
|
|
202
202
|
runner: (context: ITestContext, name: string, file: string, env: ITestEnv) => ITestRunner;
|
|
203
203
|
};
|
|
204
|
+
declare global {
|
|
205
|
+
var __TEST_PATH__: string;
|
|
206
|
+
var __TEST_FIXTURES_PATH__: string;
|
|
207
|
+
var __TEST_DIST_PATH__: string;
|
|
208
|
+
var __ROOT_PATH__: string;
|
|
209
|
+
var __RSPACK_PATH__: string;
|
|
210
|
+
var __RSPACK_TEST_TOOLS_PATH__: string;
|
|
211
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/test-tools",
|
|
3
|
-
"version": "1.5.9-canary-
|
|
3
|
+
"version": "1.5.9-canary-e259bc79-20251014173821",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Test tools for rspack",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"./package.json": "./package.json",
|
|
16
16
|
"./helper/*": "./dist/helper/*.js",
|
|
17
17
|
"./helper/legacy/*": "./dist/helper/legacy/*.js",
|
|
18
|
-
"./helper/util/*": "./dist/helper/util/*.js"
|
|
18
|
+
"./helper/util/*": "./dist/helper/util/*.js",
|
|
19
|
+
"./jest/*": "./dist/jest/*.js"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"client",
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"@babel/parser": "7.28.4",
|
|
40
41
|
"@babel/traverse": "7.28.4",
|
|
41
42
|
"@babel/types": "7.28.4",
|
|
43
|
+
"@jest/reporters": "29.7.0",
|
|
42
44
|
"cross-env": "^10.1.0",
|
|
43
45
|
"csv-to-markdown-table": "1.5.0",
|
|
44
46
|
"deepmerge": "^4.3.1",
|
|
@@ -49,6 +51,7 @@
|
|
|
49
51
|
"iconv-lite": "^0.6.3",
|
|
50
52
|
"jest-diff": "^29.7.0",
|
|
51
53
|
"jest-snapshot": "29.7.0",
|
|
54
|
+
"jest-environment-node": "29.7.0",
|
|
52
55
|
"jsdom": "^26.1.0",
|
|
53
56
|
"memfs": "4.48.1",
|
|
54
57
|
"loader-utils": "^2.0.4",
|
|
@@ -100,10 +103,10 @@
|
|
|
100
103
|
"wast-loader": "^1.14.1",
|
|
101
104
|
"worker-rspack-loader": "^3.1.2",
|
|
102
105
|
"exports-loader": "^5.0.0",
|
|
103
|
-
"@rspack/cli": "npm:@rspack-canary/cli@1.5.9-canary-
|
|
106
|
+
"@rspack/cli": "npm:@rspack-canary/cli@1.5.9-canary-e259bc79-20251014173821",
|
|
104
107
|
"@rspack/binding-testing": "1.4.1",
|
|
105
|
-
"@rspack/core": "npm:@rspack-canary/core@1.5.9-canary-
|
|
106
|
-
"@rspack/test-tools": "npm:@rspack-canary/test-tools@1.5.9-canary-
|
|
108
|
+
"@rspack/core": "npm:@rspack-canary/core@1.5.9-canary-e259bc79-20251014173821",
|
|
109
|
+
"@rspack/test-tools": "npm:@rspack-canary/test-tools@1.5.9-canary-e259bc79-20251014173821"
|
|
107
110
|
},
|
|
108
111
|
"peerDependencies": {
|
|
109
112
|
"@rspack/core": ">=1.0.0"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare function _exports(appendTarget: any): {
|
|
2
|
-
log: (l: any) => any;
|
|
3
|
-
debug: (l: any) => any;
|
|
4
|
-
trace: (l: any) => any;
|
|
5
|
-
info: (l: any) => any;
|
|
6
|
-
warn: {
|
|
7
|
-
(...data: any[]): void;
|
|
8
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
9
|
-
};
|
|
10
|
-
error: {
|
|
11
|
-
(...data: any[]): void;
|
|
12
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
13
|
-
};
|
|
14
|
-
logTime: () => void;
|
|
15
|
-
group: () => void;
|
|
16
|
-
groupCollapsed: () => void;
|
|
17
|
-
groupEnd: () => void;
|
|
18
|
-
profile: () => void;
|
|
19
|
-
profileEnd: () => void;
|
|
20
|
-
clear: () => void;
|
|
21
|
-
status: () => void;
|
|
22
|
-
};
|
|
23
|
-
export = _exports;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
module.exports = appendTarget => {
|
|
4
|
-
return {
|
|
5
|
-
log: l => appendTarget.push(l),
|
|
6
|
-
debug: l => appendTarget.push(l),
|
|
7
|
-
trace: l => appendTarget.push(l),
|
|
8
|
-
info: l => appendTarget.push(l),
|
|
9
|
-
warn: console.warn.bind(console),
|
|
10
|
-
error: console.error.bind(console),
|
|
11
|
-
logTime: () => { },
|
|
12
|
-
group: () => { },
|
|
13
|
-
groupCollapsed: () => { },
|
|
14
|
-
groupEnd: () => { },
|
|
15
|
-
profile: () => { },
|
|
16
|
-
profileEnd: () => { },
|
|
17
|
-
clear: () => { },
|
|
18
|
-
status: () => { }
|
|
19
|
-
};
|
|
20
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
const diff = require("jest-diff").diff;
|
|
4
|
-
const { stripVTControlCharacters: stripAnsi } = require("node:util");
|
|
5
|
-
const processStats = str => {
|
|
6
|
-
return str.trim().split('\n').map(i => i.trim()).join('\n').replace(/\d+(\.\d+)?/g, 'XX').replace(/"/g, "");
|
|
7
|
-
};
|
|
8
|
-
const webpackStats = require('../__snapshots__/StatsTestCases.basictest.js.snap.webpack');
|
|
9
|
-
module.exports = (rawStats, name) => {
|
|
10
|
-
const key = `StatsTestCases should print correct stats for ${name} 1`;
|
|
11
|
-
const res = stripAnsi(diff(processStats(rawStats), processStats(webpackStats[key] || ''), { expand: false, contextLines: 0 }));
|
|
12
|
-
return res;
|
|
13
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
const nodeVersion = process.versions.node.split(".").map(Number);
|
|
4
|
-
module.exports = function supportsWorker() {
|
|
5
|
-
// Verify that in the current node version new Worker() accepts URL as the first parameter:
|
|
6
|
-
// https://nodejs.org/api/worker_threads.html#worker_threads_new_worker_filename_options
|
|
7
|
-
if (nodeVersion[0] >= 14) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
else if (nodeVersion[0] === 13 && nodeVersion[1] >= 12) {
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
else if (nodeVersion[0] === 12 && nodeVersion[1] >= 17) {
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
describe("warmup", () => {
|
|
4
|
-
it("should warmup webpack", done => {
|
|
5
|
-
let webpack = require("@rspack/core");
|
|
6
|
-
const END = new Error("end warmup");
|
|
7
|
-
webpack({
|
|
8
|
-
entry: "data:text/javascript,import 'data:text/javascript,'",
|
|
9
|
-
plugins: [
|
|
10
|
-
c => c.hooks.emit.tap("Warmup", () => {
|
|
11
|
-
throw END;
|
|
12
|
-
})
|
|
13
|
-
]
|
|
14
|
-
}, err => {
|
|
15
|
-
webpack = undefined;
|
|
16
|
-
try {
|
|
17
|
-
// CHANGE: rspack will format error into diagnostic.
|
|
18
|
-
expect(err.message).toContain("end warmup");
|
|
19
|
-
done();
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
done(e);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}, 300000);
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function (this: any, c: string): string;
|