Skip to content

Commit c261e65

Browse files
anshumanvsnitin315
andauthored
chore: display running webpack version during tests (#2026)
* chore: display running webpack version during tests * chore: disable cache for webpack install * tests: fix progress test for webpack 4 * chore: add endl Co-authored-by: Nitin Kumar <[email protected]> Co-authored-by: Nitin Kumar <[email protected]>
1 parent 56d3228 commit c261e65

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

.github/workflows/nodejs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ jobs:
8383
yarn bootstrap
8484
8585
- name: Install webpack ${{ matrix.webpack-version }}
86-
if: steps.cache.outputs.cache-hit != 'true'
8786
run: yarn add -W webpack@${{ matrix.webpack-version }}
8887

8988
- name: Build

jest.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ module.exports = {
1717
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
1818
setupFilesAfterEnv: ['<rootDir>/setupTest.js'],
1919
globalTeardown: '<rootDir>/scripts/cleanupTest.js',
20+
globalSetup: '<rootDir>/scripts/globalSetup.js',
2021
modulePathIgnorePatterns: ['<rootDir>/test/loader/test-loader', '<rootDir>/test/plugin/test-plugin'],
2122
};

scripts/globalSetup.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const { version } = require('webpack');
2+
3+
module.exports = () => console.log(`\n Running tests for webpack @${version} \n`);

test/progress/progress-flag.test.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const { run } = require('../utils/test-utils');
3+
const { run, isWebpack5 } = require('../utils/test-utils');
44

55
describe('progress flag', () => {
66
it('should show progress', () => {
@@ -16,7 +16,9 @@ describe('progress flag', () => {
1616
const { stderr, stdout, exitCode } = run(__dirname, ['--progress=profile']);
1717

1818
expect(exitCode).toBe(0);
19-
expect(stderr).toMatch(/\[webpack\.Progress] \d+ ms setup/);
19+
if (isWebpack5) {
20+
expect(stderr).toMatch(/\[webpack\.Progress] \d+ ms setup/);
21+
}
2022
expect(stderr).toContain('[webpack.Progress] 100%');
2123
expect(stdout).toContain('main.js');
2224
});

0 commit comments

Comments
 (0)