Skip to content

Commit

Permalink
chore: align configCases runner
Browse files Browse the repository at this point in the history
  • Loading branch information
h-a-n-a committed Feb 21, 2024
1 parent 21154e0 commit 70800ab
Show file tree
Hide file tree
Showing 282 changed files with 2,755 additions and 40,796 deletions.
5 changes: 5 additions & 0 deletions crates/rspack_core/src/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 289,11 @@ impl Compilation {
filename,
is_source_equal
);
println!(
"original:{}\n asset_source:{}",
original_source.source().to_string(),
asset_source.source().to_string()
);
self.push_diagnostic(
error!(
"Conflict: Multiple assets emit different content to the same filename {}{}",
Expand Down
1 change: 1 addition & 0 deletions packages/rspack/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 6,7 @@ const config = {
testMatch: [
"<rootDir>/tests/*.test.ts",
"<rootDir>/tests/*.basictest.ts",
"<rootDir>/tests/*.basictest.js",
"<rootDir>/tests/*.longtest.ts",
"<rootDir>/tests/*.unittest.ts",
"<rootDir>/tests/copyPlugin/*.test.js",
Expand Down
1 change: 1 addition & 0 deletions packages/rspack/src/Compilation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 849,7 @@ export class Compilation {
this.#inner.rebuildModule(
args.map(item => item[0]),
function (err: any, modules: JsModule[]) {
console.log(err);
for (const [id, callback] of args) {
const m = modules.find(item => item.moduleIdentifier === id);
if (m) {
Expand Down
20 changes: 13 additions & 7 deletions packages/rspack/src/rspack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 103,17 @@ function rspack(
options: MultiRspackOptions | RspackOptions,
callback?: Callback<Error, MultiStats> | Callback<Error, Stats>
) {
asArray(options).every(opts => {
validate(opts, rspackOptions);
});
try {
for (let o of asArray(options)) {
validate(o, rspackOptions);
}
} catch (e) {
if (e instanceof Error) {
callback?.(e);
return;
}
throw e;
}
const create = () => {
if (isMultiRspackOptions(options)) {
const compiler = createMultiCompiler(options);
Expand Down Expand Up @@ -139,10 147,8 @@ function rspack(
} else {
const { compiler, watch } = create();
if (watch) {
util.deprecate(
() => {},
"A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback."
)();
util.deprecate(() => {},
"A 'callback' argument needs to be provided to the 'rspack(options, callback)' function when the 'watch' option is set. There is no way to handle the 'watch' option without a callback.")();
}
return compiler;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/rspack/tests/ConfigTestCases.basictest.js
Original file line number Diff line number Diff line change
@@ -0,0 1,5 @@
const { describeCases } = require("./ConfigTestCases.template");

describeCases({
name: "ConfigTestCases"
});
Loading

0 comments on commit 70800ab

Please sign in to comment.