Skip to content

Commit ef4297e

Browse files
yoannmoinetevilebottnawi
authored andcommitted
test: add test for stats.warningsFilter (#1732)
1 parent efaa740 commit ef4297e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/Server.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,29 @@ const allStats = [
1616
];
1717

1818
describe('Server', () => {
19+
it('should cascade warningsFilter', () => {
20+
const stats = { warningsFilter: 'test' };
21+
return new Promise((res) => {
22+
const compiler = webpack(config);
23+
const server = new Server(compiler, { stats });
24+
25+
compiler.hooks.done.tap('webpack-dev-server', (s) => {
26+
s.compilation.warnings = ['test', 'another warning'];
27+
28+
const output = server.getStats(s);
29+
expect(output.warnings.length).toBe(1);
30+
expect(output.warnings[0]).toBe('another warning');
31+
32+
server.close(() => {
33+
res();
34+
});
35+
});
36+
37+
compiler.run(() => {});
38+
server.listen(8080, 'localhost');
39+
});
40+
});
41+
1942
it(`should cascade stats options`, () => {
2043
return new Promise((resolve, reject) => {
2144
(function iterate(stats, i) {

0 commit comments

Comments
 (0)