Skip to content

Commit 74ce319

Browse files
committed
test: add tests for new startCallback and stopCallback error handling
1 parent 27d8518 commit 74ce319

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/e2e/api.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,29 @@ describe("API", () => {
8080
});
8181
});
8282

83+
it(`should catch errors within startCallback`, async () => {
84+
const compiler = webpack(config);
85+
const server = new Server(
86+
{ port, static: "https://absolute-url.com/somewhere" },
87+
compiler
88+
);
89+
90+
await new Promise((resolve) => {
91+
server.startCallback((err) => {
92+
expect(err.message).toEqual(
93+
"Using a URL as static.directory is not supported"
94+
);
95+
resolve();
96+
});
97+
});
98+
99+
await new Promise((resolve) => {
100+
server.stopCallback(() => {
101+
resolve();
102+
});
103+
});
104+
});
105+
83106
it(`should work when using configured manually`, async () => {
84107
const compiler = webpack({
85108
...config,

0 commit comments

Comments
 (0)