Skip to content
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

refactor: drop webpack v4 from tests, packages, and CI #3338

Merged
merged 3 commits into from
Jul 18, 2022
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
5 changes: 4 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@
"Nitin",
"smoketest",
"dbaeumer",
"esbenp"
"esbenp",
"msuccessfully",
"mfirst",
"msecond"
],
"dictionaries": ["npm", "software-terms"],
"ignorePaths": [
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ jobs:
os: ubuntu-latest
dev-server-version: version-3
webpack-version: latest
- node-version: 16.x
os: ubuntu-latest
dev-server-version: latest
webpack-version: webpack-4

steps:
- uses: actions/checkout@v3
Expand All @@ -82,10 +78,6 @@ jobs:
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines

- name: Install webpack ${{ matrix.webpack-version }}
if: matrix.webpack-version == '4'
run: yarn add -W webpack@${{ matrix.webpack-version }} --ignore-engines

- name: Install webpack-dev-server ${{ matrix.dev-server-version }}
if: matrix.dev-server-version == 'version-3'
run: yarn add -W webpack-dev-server@${{ matrix.dev-server-version }} --ignore-engines
Expand Down
2 changes: 1 addition & 1 deletion packages/configtest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"lib"
],
"peerDependencies": {
"webpack": "4.x.x || 5.x.x",
"webpack": "5.x.x",
"webpack-cli": "4.x.x"
}
}
3 changes: 2 additions & 1 deletion packages/generators/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"yeoman-generator": "^4.12.0"
},
"peerDependencies": {
"webpack": "4.x.x || 5.x.x"
"webpack": "5.x.x",
"webpack-cli": "4.x.x"
},
"peerDependenciesMeta": {
"prettier": {
Expand Down
1 change: 1 addition & 0 deletions packages/info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
},
"gitHead": "fb50f766851f500ca12867a2aa9de81fa6e368f9",
"peerDependencies": {
"webpack": "5.x.x",
"webpack-cli": "4.x.x"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/serve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"lib"
],
"peerDependencies": {
"webpack": "5.x.x",
"webpack-cli": "4.x.x"
},
"peerDependenciesMeta": {
Expand Down
1 change: 0 additions & 1 deletion packages/serve/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line node/no-extraneous-import
import type { Compiler, cli } from "webpack";
import { IWebpackCLI, WebpackDevServerOptions } from "webpack-cli";

Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"webpack-merge": "^5.7.3"
},
"peerDependencies": {
"webpack": "4.x.x || 5.x.x"
"webpack": "5.x.x"
},
"peerDependenciesMeta": {
"@webpack-cli/generators": {
Expand Down
146 changes: 55 additions & 91 deletions test/build/cache/cache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const path = require("path");
// eslint-disable-next-line node/no-unpublished-require
const rimraf = require("rimraf");
const { run, isWebpack5 } = require("../../utils/test-utils");
const { run } = require("../../utils/test-utils");

describe("cache", () => {
it("should work", async () => {
Expand All @@ -14,25 +14,19 @@ describe("cache", () => {
let { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]);

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();

({ exitCode, stderr, stdout } = await run(__dirname, ["-c", "./webpack.config.js"]));

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
});

it("should work in multi compiler mode", async () => {
Expand All @@ -46,25 +40,19 @@ describe("cache", () => {
let { exitCode, stderr, stdout } = await run(__dirname, ["-c", "./multi.config.js"]);

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/No pack exists at/g)).toHaveLength(2);
expect(stderr.match(/Stored pack/g)).toHaveLength(2);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/No pack exists at/g)).toHaveLength(2);
expect(stderr.match(/Stored pack/g)).toHaveLength(2);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();

({ exitCode, stderr, stdout } = await run(__dirname, ["-c", "./multi.config.js"]));

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/restore cache container:/g)).toHaveLength(2);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(2);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(2);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/restore cache container:/g)).toHaveLength(2);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(2);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(2);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
});

it("should work in multi compiler mode with the `--config-name` argument", async () => {
Expand All @@ -82,13 +70,10 @@ describe("cache", () => {
]);

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();

({ exitCode, stderr, stdout } = await run(__dirname, [
"-c",
Expand All @@ -100,14 +85,11 @@ describe("cache", () => {
]));

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
});

it("should work with the `--merge` argument", async () => {
Expand All @@ -126,13 +108,10 @@ describe("cache", () => {
]);

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();

({ exitCode, stderr, stdout } = await run(__dirname, [
"-c",
Expand All @@ -145,14 +124,11 @@ describe("cache", () => {
]));

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
});

it("should work with the `--config-name` and `--merge` argument", async () => {
Expand All @@ -175,13 +151,10 @@ describe("cache", () => {
]);

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();

({ exitCode, stderr, stdout } = await run(__dirname, [
"-c",
Expand All @@ -198,14 +171,11 @@ describe("cache", () => {
]));

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
});

it("should work with autoloading configuration", async () => {
Expand All @@ -219,24 +189,18 @@ describe("cache", () => {
let { exitCode, stderr, stdout } = await run(__dirname, ["--name", "cache-test-autoloading"]);

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/No pack exists at/g)).toHaveLength(1);
expect(stderr.match(/Stored pack/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();

({ exitCode, stderr, stdout } = await run(__dirname, ["--name", "cache-test-autoloading"]));

expect(exitCode).toEqual(0);

if (isWebpack5) {
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
}
expect(stderr.match(/restore cache container:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content metadata:/g)).toHaveLength(1);
expect(stderr.match(/restore cache content \d+ \(.+\):/g)).toHaveLength(1);
expect(stderr).toBeTruthy();
expect(stdout).toBeTruthy();
});
});
Loading