Skip to content

Commit

Permalink
chore: display running webpack version during tests (#2026)
Browse files Browse the repository at this point in the history
* 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 <snitin315@gmail.com>

Co-authored-by: Nitin Kumar <snitin315@gmail.com>
  • Loading branch information
anshumanv and snitin315 committed Nov 3, 2020
1 parent 56d3228 commit c261e65
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/nodejs.yml
Expand Up @@ -83,7 +83,6 @@ jobs:
yarn bootstrap
- name: Install webpack ${{ matrix.webpack-version }}
if: steps.cache.outputs.cache-hit != 'true'
run: yarn add -W webpack@${{ matrix.webpack-version }}

- name: Build
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Expand Up @@ -17,5 +17,6 @@ module.exports = {
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
setupFilesAfterEnv: ['<rootDir>/setupTest.js'],
globalTeardown: '<rootDir>/scripts/cleanupTest.js',
globalSetup: '<rootDir>/scripts/globalSetup.js',
modulePathIgnorePatterns: ['<rootDir>/test/loader/test-loader', '<rootDir>/test/plugin/test-plugin'],
};
3 changes: 3 additions & 0 deletions scripts/globalSetup.js
@@ -0,0 +1,3 @@
const { version } = require('webpack');

module.exports = () => console.log(`\n Running tests for webpack @${version} \n`);
6 changes: 4 additions & 2 deletions test/progress/progress-flag.test.js
@@ -1,6 +1,6 @@
'use strict';

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

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

expect(exitCode).toBe(0);
expect(stderr).toMatch(/\[webpack\.Progress] \d+ ms setup/);
if (isWebpack5) {
expect(stderr).toMatch(/\[webpack\.Progress] \d+ ms setup/);
}
expect(stderr).toContain('[webpack.Progress] 100%');
expect(stdout).toContain('main.js');
});
Expand Down

0 comments on commit c261e65

Please sign in to comment.