-
-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): Phantom dependencies of x.mjs and scripts (#7178)
* chore(deps): Phantom dependence of x.mjs * chore(deps): Phantom dependence of x.mjs
- Loading branch information
Showing
6 changed files
with
216 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,85 @@ | ||
// @ts-nocheck | ||
const { Tester, DiffProcessor, DiffStatsReporter, DiffHtmlReporter } = require("../packages/rspack-test-tools/dist"); | ||
const { | ||
Tester, | ||
DiffProcessor, | ||
DiffStatsReporter, | ||
DiffHtmlReporter | ||
} = require("../packages/rspack-test-tools/dist"); | ||
const rimraf = require("rimraf"); | ||
const path = require("path"); | ||
const path = require("node:path"); | ||
const fs = require("fs-extra"); | ||
|
||
process.env['RSPACK_DIFF'] = "true"; // enable rspack diff injection | ||
process.env["RSPACK_DIFF"] = "true"; // enable rspack diff injection | ||
|
||
const CASE_DIR = path.resolve(__dirname, '../tests/diff-test'); | ||
const OUTPUT_DIR = path.join(__dirname, '../diff_output'); | ||
const CASE_DIR = path.resolve(__dirname, "../tests/diff-test"); | ||
const OUTPUT_DIR = path.join(__dirname, "../diff_output"); | ||
|
||
(async () => { | ||
const cases = fs | ||
.readdirSync(CASE_DIR) | ||
.filter(testName => !testName.startsWith(".")); | ||
const cases = fs | ||
.readdirSync(CASE_DIR) | ||
.filter(testName => !testName.startsWith(".")); | ||
|
||
rimraf.sync(OUTPUT_DIR); | ||
rimraf.sync(OUTPUT_DIR); | ||
|
||
const statsReporter = new DiffStatsReporter({ | ||
file: path.join(OUTPUT_DIR, 'stats.md'), | ||
report: true, | ||
}); | ||
const htmlReporter = new DiffHtmlReporter({ | ||
dist: OUTPUT_DIR, | ||
ignore: { | ||
test: () => false, | ||
}, | ||
}); | ||
const statsReporter = new DiffStatsReporter({ | ||
file: path.join(OUTPUT_DIR, "stats.md"), | ||
report: true | ||
}); | ||
const htmlReporter = new DiffHtmlReporter({ | ||
dist: OUTPUT_DIR, | ||
ignore: { | ||
test: () => false | ||
} | ||
}); | ||
|
||
while (cases.length) { | ||
const name = cases.shift(); | ||
const source = path.join(CASE_DIR, name); | ||
try { | ||
const processor = new DiffProcessor({ | ||
webpackPath: require.resolve('webpack'), | ||
rspackPath: require.resolve('../packages/rspack'), | ||
files: ['bundle.js', 'main.js'], | ||
modules: true, | ||
runtimeModules: true, | ||
ignoreModuleId: true, | ||
ignoreModuleArguments: true, | ||
ignorePropertyQuotationMark: true, | ||
ignoreBlockOnlyStatement: true, | ||
ignoreSwcHelpersPath: true, | ||
ignoreObjectPropertySequence: true, | ||
ignoreCssFilePath: true, | ||
detail: false, | ||
onCompareModules: (file, results) => { | ||
htmlReporter.increment(name, results); | ||
statsReporter.increment(name, results); | ||
}, | ||
onCompareRuntimeModules: (file, results) => { | ||
htmlReporter.increment(name, results); | ||
statsReporter.increment(name, results); | ||
}, | ||
}); | ||
while (cases.length) { | ||
const name = cases.shift(); | ||
const source = path.join(CASE_DIR, name); | ||
try { | ||
const processor = new DiffProcessor({ | ||
webpackPath: require.resolve("webpack"), | ||
rspackPath: require.resolve("../packages/rspack"), | ||
files: ["bundle.js", "main.js"], | ||
modules: true, | ||
runtimeModules: true, | ||
ignoreModuleId: true, | ||
ignoreModuleArguments: true, | ||
ignorePropertyQuotationMark: true, | ||
ignoreBlockOnlyStatement: true, | ||
ignoreSwcHelpersPath: true, | ||
ignoreObjectPropertySequence: true, | ||
ignoreCssFilePath: true, | ||
detail: false, | ||
onCompareModules: (file, results) => { | ||
htmlReporter.increment(name, results); | ||
statsReporter.increment(name, results); | ||
}, | ||
onCompareRuntimeModules: (file, results) => { | ||
htmlReporter.increment(name, results); | ||
statsReporter.increment(name, results); | ||
} | ||
}); | ||
|
||
const tester = new Tester({ | ||
name: 'test', | ||
src: source, | ||
dist: path.join(source, "dist"), | ||
steps: [processor] | ||
}); | ||
const tester = new Tester({ | ||
name: "test", | ||
src: source, | ||
dist: path.join(source, "dist"), | ||
steps: [processor] | ||
}); | ||
|
||
rimraf.sync(path.join(source, "dist")); | ||
await tester.prepare(); | ||
do { | ||
await tester.compile(); | ||
await tester.check({ expect: () => ({ toBe: (() => { }) }) }); | ||
} while (tester.next()); | ||
await tester.resume(); | ||
} catch (e) { | ||
htmlReporter.failure(name) | ||
statsReporter.failure(name); | ||
console.error(e); | ||
} | ||
} | ||
await htmlReporter.output(); | ||
await statsReporter.output(); | ||
rimraf.sync(path.join(source, "dist")); | ||
await tester.prepare(); | ||
do { | ||
await tester.compile(); | ||
await tester.check({ expect: () => ({ toBe: () => {} }) }); | ||
} while (tester.next()); | ||
await tester.resume(); | ||
} catch (e) { | ||
htmlReporter.failure(name); | ||
statsReporter.failure(name); | ||
console.error(e); | ||
} | ||
} | ||
await htmlReporter.output(); | ||
await statsReporter.output(); | ||
})(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5150790
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
5150790
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open