-
-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): display error when plugin throw an error during serve starting
- Loading branch information
1 parent
8243df6
commit 6e62fa2
Showing
3 changed files
with
29 additions
and
1 deletion.
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
13 changes: 13 additions & 0 deletions
13
packages/rspack-cli/tests/serve/plugin-apply-error/rspack.config.js
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
mode: "development", | ||
devtool: false, | ||
plugins: [ | ||
{ | ||
name: "test-plugin", | ||
apply(compiler) { | ||
throw new Error("error in plugin"); | ||
} | ||
} | ||
], | ||
devServer: {} | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/rspack-cli/tests/serve/plugin-apply-error/serve-plugin-apply-error.test.ts
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { normalizeStderr, runWatch } from "../../utils/test-utils"; | ||
|
||
describe("should display plugin error", () => { | ||
it("display error", async () => { | ||
const { stderr } = await runWatch(__dirname, ["serve"], { | ||
killString: /Error: / | ||
}); | ||
|
||
expect(normalizeStderr(stderr)).toContain("error in plugin"); | ||
}); | ||
}); |