Skip to content

chore: update webpack-dev-middleware #3015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"strip-ansi": "^6.0.0",
"url": "^0.11.0",
"util": "^0.12.3",
"webpack-dev-middleware": "^4.0.2",
"webpack-dev-middleware": "^4.1.0",
"ws": "^7.4.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion setupTest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

process.env.CHOKIDAR_USEPOLLING = true;
jest.setTimeout(120000);
jest.setTimeout(180000);

// retry 3 times for flaky tests
jest.retryTimes(3);
28 changes: 14 additions & 14 deletions test/cli/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('CLI', () => {
testBin('--hot')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('webpack/hot/dev-server.js');
expect(output.stdout).toContain('webpack/hot/dev-server.js');
done();
})
.catch(done);
Expand All @@ -24,7 +24,7 @@ describe('CLI', () => {
testBin('--no-hot')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
expect(output.stdout).not.toContain('webpack/hot/dev-server.js');
done();
})
.catch(done);
Expand All @@ -35,7 +35,7 @@ describe('CLI', () => {
testBin('--hot --stats=detailed')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('webpack/hot/dev-server.js');
expect(output.stdout).toContain('webpack/hot/dev-server.js');
done();
})
.catch(done);
Expand All @@ -45,7 +45,7 @@ describe('CLI', () => {
testBin('--no-hot --stats=detailed')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).not.toContain('webpack/hot/dev-server.js');
expect(output.stdout).not.toContain('webpack/hot/dev-server.js');
done();
})
.catch(done);
Expand All @@ -56,7 +56,7 @@ describe('CLI', () => {
testBin('--hot-only --stats detailed')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('/hot/only-dev-server');
expect(output.stdout).toContain('/hot/only-dev-server');
done();
})
.catch(done);
Expand Down Expand Up @@ -152,7 +152,7 @@ describe('CLI', () => {
expect(err.stderr).toContain(
"webpack output is served from '/foo/bar' URL"
);
expect(err.stderr).toContain('Compiled successfully.');
expect(err.stdout).toContain('main.js');
done();
});
});
Expand All @@ -177,7 +177,7 @@ describe('CLI', () => {
expect(err.stderr).toContain(
`Content not from webpack is served from '${staticDirectory}' directory`
);
expect(err.stderr).toContain('Compiled successfully.');
expect(err.stdout).toContain('main.js');
done();
});
});
Expand All @@ -193,7 +193,7 @@ describe('CLI', () => {
})
.catch((err) => {
// for windows
expect(err.stderr).toContain('Compiled successfully.');
expect(err.stdout).toContain('main.js');
done();
});
});
Expand All @@ -203,10 +203,10 @@ describe('CLI', () => {
const examplePath = path.resolve(__dirname, '../../examples/cli/public');
const cp = execa('node', [cliPath], { cwd: examplePath });

cp.stderr.on('data', (data) => {
cp.stdout.on('data', (data) => {
const bits = data.toString();

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

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

let killed = false;

cp.stderr.on('data', () => {
cp.stdout.on('data', () => {
if (!killed) {
expect(cp.pid !== 0).toBe(true);

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

cp.stderr.on('data', (data) => {
cp.stdout.on('data', (data) => {
const bits = data.toString();

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

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

let killed = false;

cp.stderr.on('data', () => {
cp.stdout.on('data', () => {
if (!killed) {
expect(cp.pid !== 0).toBe(true);

Expand Down
47 changes: 25 additions & 22 deletions test/e2e/DevServer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,35 @@ describe('DevServer', () => {
testBin('--config ./test/fixtures/dev-server/default-config.js')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('client/default/index.js?');
expect(output.stdout).toContain('client/default/index.js?');
done();
})
.catch(done);
});

it('should add devServer entry points to a multi entry point object', (done) => {
testBin(
'--config ./test/fixtures/dev-server/multi-entry.js --stats=verbose'
)
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('client/default/index.js?');
expect(output.stderr).toContain('foo.js');
done();
})
.catch(done);
});
webpack5Test(
'should add devServer entry points to a multi entry point object',
(done) => {
testBin(
'--config ./test/fixtures/dev-server/multi-entry.js --stats=verbose'
)
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stdout).toContain('client/default/index.js?');
expect(output.stdout).toContain('foo.js');
done();
})
.catch(done);
}
);

webpack5Test('should supports entry as descriptor', (done) => {
testBin(
'--config ./test/fixtures/entry-as-descriptor/webpack.config --stats detailed'
)
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('foo.js');
expect(output.stdout).toContain('foo.js');
done();
})
.catch(done);
Expand All @@ -47,8 +50,8 @@ describe('DevServer', () => {
)
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('client/default/index.js?');
expect(output.stderr).toContain('foo.js');
expect(output.stdout).toContain('client/default/index.js?');
expect(output.stdout).toContain('foo.js');
done();
})
.catch(done);
Expand All @@ -60,8 +63,8 @@ describe('DevServer', () => {
)
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).not.toContain('client/default/index.js?');
expect(output.stderr).toContain('foo.js');
expect(output.stdout).not.toContain('client/default/index.js?');
expect(output.stdout).toContain('foo.js');
done();
})
.catch(done);
Expand All @@ -73,7 +76,7 @@ describe('DevServer', () => {
)
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('webpack/hot/dev-server');
expect(output.stdout).toContain('webpack/hot/dev-server');
done();
})
.catch(done);
Expand All @@ -83,7 +86,7 @@ describe('DevServer', () => {
testBin('--config ./test/fixtures/dev-server/client-default-path-config.js')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).not.toContain('&path=/ws');
expect(output.stdout).not.toContain('&path=/ws');
done();
})
.catch(done);
Expand All @@ -93,7 +96,7 @@ describe('DevServer', () => {
testBin('--config ./test/fixtures/dev-server/client-custom-path-config.js')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('&path=/custom/path');
expect(output.stdout).toContain('&path=/custom/path');
done();
})
.catch(done);
Expand All @@ -105,7 +108,7 @@ describe('DevServer', () => {
testBin('--config ./test/fixtures/dev-server/target-config.js')
.then((output) => {
expect(output.exitCode).toEqual(0);
expect(output.stderr).toContain('client/default/index.js');
expect(output.stdout).toContain('client/default/index.js');
done();
})
.catch(done);
Expand Down