Skip to content

Commit b134a6c

Browse files
authored
chore: update webpack-dev-middleware (#3015)
1 parent d164aea commit b134a6c

File tree

5 files changed

+62
-44
lines changed

5 files changed

+62
-44
lines changed

package-lock.json

Lines changed: 21 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"strip-ansi": "^6.0.0",
6363
"url": "^0.11.0",
6464
"util": "^0.12.3",
65-
"webpack-dev-middleware": "^4.0.2",
65+
"webpack-dev-middleware": "^4.1.0",
6666
"ws": "^7.4.3"
6767
},
6868
"devDependencies": {

setupTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
process.env.CHOKIDAR_USEPOLLING = true;
4-
jest.setTimeout(120000);
4+
jest.setTimeout(180000);
55

66
// retry 3 times for flaky tests
77
jest.retryTimes(3);

test/cli/cli.test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('CLI', () => {
1414
testBin('--hot')
1515
.then((output) => {
1616
expect(output.exitCode).toEqual(0);
17-
expect(output.stderr).toContain('webpack/hot/dev-server.js');
17+
expect(output.stdout).toContain('webpack/hot/dev-server.js');
1818
done();
1919
})
2020
.catch(done);
@@ -24,7 +24,7 @@ describe('CLI', () => {
2424
testBin('--no-hot')
2525
.then((output) => {
2626
expect(output.exitCode).toEqual(0);
27-
expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
27+
expect(output.stdout).not.toContain('webpack/hot/dev-server.js');
2828
done();
2929
})
3030
.catch(done);
@@ -35,7 +35,7 @@ describe('CLI', () => {
3535
testBin('--hot --stats=detailed')
3636
.then((output) => {
3737
expect(output.exitCode).toEqual(0);
38-
expect(output.stderr).toContain('webpack/hot/dev-server.js');
38+
expect(output.stdout).toContain('webpack/hot/dev-server.js');
3939
done();
4040
})
4141
.catch(done);
@@ -45,7 +45,7 @@ describe('CLI', () => {
4545
testBin('--no-hot --stats=detailed')
4646
.then((output) => {
4747
expect(output.exitCode).toEqual(0);
48-
expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
48+
expect(output.stdout).not.toContain('webpack/hot/dev-server.js');
4949
done();
5050
})
5151
.catch(done);
@@ -56,7 +56,7 @@ describe('CLI', () => {
5656
testBin('--hot-only --stats detailed')
5757
.then((output) => {
5858
expect(output.exitCode).toEqual(0);
59-
expect(output.stderr).toContain('/hot/only-dev-server');
59+
expect(output.stdout).toContain('/hot/only-dev-server');
6060
done();
6161
})
6262
.catch(done);
@@ -152,7 +152,7 @@ describe('CLI', () => {
152152
expect(err.stderr).toContain(
153153
"webpack output is served from '/foo/bar' URL"
154154
);
155-
expect(err.stderr).toContain('Compiled successfully.');
155+
expect(err.stdout).toContain('main.js');
156156
done();
157157
});
158158
});
@@ -177,7 +177,7 @@ describe('CLI', () => {
177177
expect(err.stderr).toContain(
178178
`Content not from webpack is served from '${staticDirectory}' directory`
179179
);
180-
expect(err.stderr).toContain('Compiled successfully.');
180+
expect(err.stdout).toContain('main.js');
181181
done();
182182
});
183183
});
@@ -193,7 +193,7 @@ describe('CLI', () => {
193193
})
194194
.catch((err) => {
195195
// for windows
196-
expect(err.stderr).toContain('Compiled successfully.');
196+
expect(err.stdout).toContain('main.js');
197197
done();
198198
});
199199
});
@@ -203,10 +203,10 @@ describe('CLI', () => {
203203
const examplePath = path.resolve(__dirname, '../../examples/cli/public');
204204
const cp = execa('node', [cliPath], { cwd: examplePath });
205205

206-
cp.stderr.on('data', (data) => {
206+
cp.stdout.on('data', (data) => {
207207
const bits = data.toString();
208208

209-
if (/Compiled successfully/.test(bits)) {
209+
if (/main.js/.test(bits)) {
210210
expect(cp.pid !== 0).toBe(true);
211211

212212
cp.kill('SIGINT');
@@ -225,7 +225,7 @@ describe('CLI', () => {
225225

226226
let killed = false;
227227

228-
cp.stderr.on('data', () => {
228+
cp.stdout.on('data', () => {
229229
if (!killed) {
230230
expect(cp.pid !== 0).toBe(true);
231231

@@ -245,10 +245,10 @@ describe('CLI', () => {
245245
const examplePath = path.resolve(__dirname, '../../examples/cli/public');
246246
const cp = execa('node', [cliPath, '--stdin'], { cwd: examplePath });
247247

248-
cp.stderr.on('data', (data) => {
248+
cp.stdout.on('data', (data) => {
249249
const bits = data.toString();
250250

251-
if (/Compiled successfully/.test(bits)) {
251+
if (/main.js/.test(bits)) {
252252
expect(cp.pid !== 0).toBe(true);
253253

254254
cp.stdin.write('hello');
@@ -268,7 +268,7 @@ describe('CLI', () => {
268268

269269
let killed = false;
270270

271-
cp.stderr.on('data', () => {
271+
cp.stdout.on('data', () => {
272272
if (!killed) {
273273
expect(cp.pid !== 0).toBe(true);
274274

test/e2e/DevServer.test.js

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,35 @@ describe('DevServer', () => {
1010
testBin('--config ./test/fixtures/dev-server/default-config.js')
1111
.then((output) => {
1212
expect(output.exitCode).toEqual(0);
13-
expect(output.stderr).toContain('client/default/index.js?');
13+
expect(output.stdout).toContain('client/default/index.js?');
1414
done();
1515
})
1616
.catch(done);
1717
});
1818

19-
it('should add devServer entry points to a multi entry point object', (done) => {
20-
testBin(
21-
'--config ./test/fixtures/dev-server/multi-entry.js --stats=verbose'
22-
)
23-
.then((output) => {
24-
expect(output.exitCode).toEqual(0);
25-
expect(output.stderr).toContain('client/default/index.js?');
26-
expect(output.stderr).toContain('foo.js');
27-
done();
28-
})
29-
.catch(done);
30-
});
19+
webpack5Test(
20+
'should add devServer entry points to a multi entry point object',
21+
(done) => {
22+
testBin(
23+
'--config ./test/fixtures/dev-server/multi-entry.js --stats=verbose'
24+
)
25+
.then((output) => {
26+
expect(output.exitCode).toEqual(0);
27+
expect(output.stdout).toContain('client/default/index.js?');
28+
expect(output.stdout).toContain('foo.js');
29+
done();
30+
})
31+
.catch(done);
32+
}
33+
);
3134

3235
webpack5Test('should supports entry as descriptor', (done) => {
3336
testBin(
3437
'--config ./test/fixtures/entry-as-descriptor/webpack.config --stats detailed'
3538
)
3639
.then((output) => {
3740
expect(output.exitCode).toEqual(0);
38-
expect(output.stderr).toContain('foo.js');
41+
expect(output.stdout).toContain('foo.js');
3942
done();
4043
})
4144
.catch(done);
@@ -47,8 +50,8 @@ describe('DevServer', () => {
4750
)
4851
.then((output) => {
4952
expect(output.exitCode).toEqual(0);
50-
expect(output.stderr).toContain('client/default/index.js?');
51-
expect(output.stderr).toContain('foo.js');
53+
expect(output.stdout).toContain('client/default/index.js?');
54+
expect(output.stdout).toContain('foo.js');
5255
done();
5356
})
5457
.catch(done);
@@ -60,8 +63,8 @@ describe('DevServer', () => {
6063
)
6164
.then((output) => {
6265
expect(output.exitCode).toEqual(0);
63-
expect(output.stderr).not.toContain('client/default/index.js?');
64-
expect(output.stderr).toContain('foo.js');
66+
expect(output.stdout).not.toContain('client/default/index.js?');
67+
expect(output.stdout).toContain('foo.js');
6568
done();
6669
})
6770
.catch(done);
@@ -73,7 +76,7 @@ describe('DevServer', () => {
7376
)
7477
.then((output) => {
7578
expect(output.exitCode).toEqual(0);
76-
expect(output.stderr).toContain('webpack/hot/dev-server');
79+
expect(output.stdout).toContain('webpack/hot/dev-server');
7780
done();
7881
})
7982
.catch(done);
@@ -83,7 +86,7 @@ describe('DevServer', () => {
8386
testBin('--config ./test/fixtures/dev-server/client-default-path-config.js')
8487
.then((output) => {
8588
expect(output.exitCode).toEqual(0);
86-
expect(output.stderr).not.toContain('&path=/ws');
89+
expect(output.stdout).not.toContain('&path=/ws');
8790
done();
8891
})
8992
.catch(done);
@@ -93,7 +96,7 @@ describe('DevServer', () => {
9396
testBin('--config ./test/fixtures/dev-server/client-custom-path-config.js')
9497
.then((output) => {
9598
expect(output.exitCode).toEqual(0);
96-
expect(output.stderr).toContain('&path=/custom/path');
99+
expect(output.stdout).toContain('&path=/custom/path');
97100
done();
98101
})
99102
.catch(done);
@@ -105,7 +108,7 @@ describe('DevServer', () => {
105108
testBin('--config ./test/fixtures/dev-server/target-config.js')
106109
.then((output) => {
107110
expect(output.exitCode).toEqual(0);
108-
expect(output.stderr).toContain('client/default/index.js');
111+
expect(output.stdout).toContain('client/default/index.js');
109112
done();
110113
})
111114
.catch(done);

0 commit comments

Comments
 (0)