Skip to content

Commit

Permalink
chore: deps and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed May 8, 2020
1 parent 41d1d0c commit f857c40
Show file tree
Hide file tree
Showing 8 changed files with 1,724 additions and 5,427 deletions.
7,072 changes: 1,668 additions & 5,404 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Expand Up @@ -54,7 +54,7 @@
"loglevel": "^1.6.8",
"opn": "^5.5.0",
"p-retry": "^3.0.1",
"portfinder": "^1.0.25",
"portfinder": "^1.0.26",
"schema-utils": "^1.0.0",
"selfsigned": "^1.10.7",
"semver": "^6.3.0",
Expand All @@ -72,10 +72,10 @@
},
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@babel/runtime": "^7.9.2",
"@babel/core": "^7.9.6",
"@babel/plugin-transform-runtime": "^7.9.6",
"@babel/preset-env": "^7.9.6",
"@babel/runtime": "^7.9.6",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"babel-loader": "^8.1.0",
Expand All @@ -84,7 +84,7 @@
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^2.1.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-config-prettier": "^6.11.0",
"eslint-config-webpack": "^1.2.5",
"eslint-plugin-import": "^2.20.2",
"execa": "^1.0.0",
Expand All @@ -94,23 +94,23 @@
"husky": "^4.2.5",
"jest": "^24.9.0",
"jest-junit": "^10.0.0",
"jquery": "^3.5.0",
"jquery": "^3.5.1",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"lint-staged": "^10.1.3",
"lint-staged": "^10.2.2",
"marked": "^0.8.2",
"memfs": "^3.1.2",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"puppeteer": "^1.20.0",
"rimraf": "^3.0.2",
"standard-version": "^7.1.0",
"style-loader": "^1.1.3",
"standard-version": "^8.0.0",
"style-loader": "^1.2.1",
"supertest": "^4.0.2",
"tcp-port-used": "^1.0.1",
"typescript": "^3.8.3",
"url-loader": "^3.0.0",
"webpack": "^4.42.1",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/cli/cli.test.js
Expand Up @@ -20,7 +20,7 @@ describe('CLI', () => {
testBin('--progress')
.then((output) => {
expect(output.code).toEqual(0);
expect(output.stderr).toContain('0% compiling');
expect(output.stderr).toContain('100%');
// should not profile
expect(output.stderr).not.toContain(
'ms after chunk modules optimization'
Expand Down
7 changes: 7 additions & 0 deletions test/helpers/isWebpack5.js
@@ -0,0 +1,7 @@
'use strict';

const webpack = require('webpack');

const isWebpack5 = webpack.version[0] === '5';

module.exports = isWebpack5;
36 changes: 28 additions & 8 deletions test/server/Server.test.js
Expand Up @@ -7,6 +7,7 @@ const { noop } = require('webpack-dev-middleware/lib/util');
const Server = require('../../lib/Server');
const config = require('../fixtures/simple-config/webpack.config');
const port = require('../ports-map').Server;
const isWebpack5 = require('../helpers/isWebpack5');

jest.mock('sockjs/lib/transport');

Expand Down Expand Up @@ -34,11 +35,20 @@ describe('Server', () => {
})
);

expect(
server.middleware.context.compiler.options.entry.map((p) => {
let entries;

if (isWebpack5) {
entries = server.middleware.context.compiler.options.entry.main.import.map(
(p) => {
return relative('.', p).split(sep);
}
);
} else {
entries = server.middleware.context.compiler.options.entry.map((p) => {
return relative('.', p).split(sep);
})
).toMatchSnapshot();
});
}
expect(entries).toMatchSnapshot();
expect(server.middleware.context.compiler.options.plugins).toEqual([
new webpack.HotModuleReplacementPlugin(),
]);
Expand All @@ -59,11 +69,21 @@ describe('Server', () => {
})
);

expect(
server.middleware.context.compiler.options.entry.map((p) => {
let entries;

if (isWebpack5) {
entries = server.middleware.context.compiler.options.entry.main.import.map(
(p) => {
return relative('.', p).split(sep);
}
);
} else {
entries = server.middleware.context.compiler.options.entry.map((p) => {
return relative('.', p).split(sep);
})
).toMatchSnapshot();
});
}

expect(entries).toMatchSnapshot();
expect(server.middleware.context.compiler.options.plugins).toEqual([
new webpack.HotModuleReplacementPlugin(),
]);
Expand Down
2 changes: 1 addition & 1 deletion test/server/profile-option.test.js
Expand Up @@ -34,7 +34,7 @@ describe('profile', () => {
calls.forEach((call) => {
const text = call[0];

if (text.includes('0% compiling')) {
if (text.includes('2%')) {
foundProgress = true;
}

Expand Down
2 changes: 1 addition & 1 deletion test/server/progress-option.test.js
Expand Up @@ -29,7 +29,7 @@ describe('progress', () => {
let foundProgress = false;
let foundProfile = false;
calls.forEach((call) => {
if (call[0].includes('0% compiling')) {
if (call[0].includes('2%')) {
foundProgress = true;
}

Expand Down
8 changes: 7 additions & 1 deletion test/server/utils/updateCompiler.test.js
Expand Up @@ -2,6 +2,7 @@

const webpack = require('webpack');
const updateCompiler = require('../../../lib/utils/updateCompiler');
const isWebpack5 = require('../../helpers/isWebpack5');

describe('updateCompiler', () => {
describe('simple config, inline', () => {
Expand Down Expand Up @@ -36,7 +37,12 @@ describe('updateCompiler', () => {
expect(compiler.hooks.entryOption.taps.length).toBe(1);
expect(tapsByHMR).toEqual(0);
expect(tapsByProvidePlugin).toEqual(1);
expect(compiler.options.plugins).toBeUndefined();

if (isWebpack5) {
expect(compiler.options.plugins).toEqual([]);
} else {
expect(compiler.options.plugins).toBeUndefined();
}
});
});

Expand Down

0 comments on commit f857c40

Please sign in to comment.