File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,3 +87,14 @@ Array [
8787`;
8888
8989exports[`API should work with deprecated API (the order of the arguments in the constructor): page errors 1`] = `Array []`;
90+
91+ exports[`API should work with plugin API: console messages 1`] = `
92+ Array [
93+ "[HMR] Waiting for update signal from WDS...",
94+ "Hey.",
95+ "[webpack-dev-server] Hot Module Replacement enabled.",
96+ "[webpack-dev-server] Live Reloading enabled.",
97+ ]
98+ `;
99+
100+ exports[`API should work with plugin API: page errors 1`] = `Array []`;
Original file line number Diff line number Diff line change @@ -8,6 +8,38 @@ const runBrowser = require("../helpers/run-browser");
88const port = require ( "../ports-map" ) . api ;
99
1010describe ( "API" , ( ) => {
11+ it ( `should work with plugin API` , async ( ) => {
12+ const compiler = webpack ( config ) ;
13+ const server = new Server ( { port } ) ;
14+
15+ server . apply ( compiler ) ;
16+
17+ const { page, browser } = await runBrowser ( ) ;
18+
19+ const pageErrors = [ ] ;
20+ const consoleMessages = [ ] ;
21+
22+ page
23+ . on ( "console" , ( message ) => {
24+ consoleMessages . push ( message ) ;
25+ } )
26+ . on ( "pageerror" , ( error ) => {
27+ pageErrors . push ( error ) ;
28+ } ) ;
29+
30+ await page . goto ( `http://127.0.0.1:${ port } /main` , {
31+ waitUntil : "networkidle0" ,
32+ } ) ;
33+
34+ expect ( consoleMessages . map ( ( message ) => message . text ( ) ) ) . toMatchSnapshot (
35+ "console messages"
36+ ) ;
37+ expect ( pageErrors ) . toMatchSnapshot ( "page errors" ) ;
38+
39+ await browser . close ( ) ;
40+ await server . stop ( ) ;
41+ } ) ;
42+
1143 it ( `should work with async API` , async ( ) => {
1244 const compiler = webpack ( config ) ;
1345 const server = new Server ( { port } , compiler ) ;
You can’t perform that action at this time.
0 commit comments