mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
fix(Bun.plugin): return on invalid target error (#24945)
### What does this PR do? ### How did you verify your code works? Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
@@ -355,6 +355,17 @@ describe("errors", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("handles invalid 'target'", () => {
|
||||
const opts = {
|
||||
setup: () => {},
|
||||
target: 123n,
|
||||
};
|
||||
|
||||
expect(() => {
|
||||
plugin(opts as any);
|
||||
}).toThrow("plugin target must be one of 'node', 'bun' or 'browser'");
|
||||
});
|
||||
|
||||
it("invalid loaders throw", () => {
|
||||
const invalidLoaders = ["blah", "blah2", "blah3", "blah4"];
|
||||
const inputs = ["body { background: red; }", "<h1>hi</h1>", '{"hi": "there"}', "hi"];
|
||||
|
||||
Reference in New Issue
Block a user