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 397e6cb commit 9b249d4
Show file tree
Hide file tree
Showing 289 changed files with 2,979 additions and 42,002 deletions.
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
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
Loading

0 comments on commit 9b249d4

Please sign in to comment.