From 55dc9b9ebe83bbbc7af8de4e7ce97741960f248a Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 14 Sep 2023 18:22:05 +0200 Subject: [PATCH 1/9] Revert "DROP: Remove cli test on win" This reverts commit fa157703fa9684d82f6b567ec5b15b65e7b039a6. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d13292bb3f..a1db72cbea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,7 +169,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [windows-latest, ubuntu-latest] node: [20, 18, 16, 14] runs-on: ${{ matrix.os }} name: CLI ${{ matrix.os }} nodejs ${{ matrix.node }} From 5be8163132e8bdfb58d94dff4626daf2af549cc1 Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 14 Sep 2023 19:08:11 +0200 Subject: [PATCH 2/9] DROP: debug test --- .github/workflows/ci.yml | 90 --------------------------- packages/cli/test/package/cli.test.js | 9 ++- 2 files changed, 8 insertions(+), 91 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1db72cbea..90505bc895 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -208,102 +208,12 @@ jobs: run: npm run test:package working-directory: packages/cli - test-package-webpack-plugin: - needs: - - build - strategy: - fail-fast: false - matrix: - os: [windows-latest, ubuntu-latest] - node: [20, 18, 16, 14] - webpack: ['webpack4', 'webpack5'] - exclude: - - webpack: 'webpack4' - node: 18 - - webpack: 'webpack4' - node: 20 - - os: windows-latest - node: 20 - - os: windows-latest - node: 18 - - os: windows-latest - node: 16 - runs-on: ${{ matrix.os }} - name: ${{ matrix.webpack }} plugin ${{ matrix.os }} nodejs ${{ matrix.node }} - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js - uses: actions/setup-node@v3.8.1 - with: - node-version: ${{ matrix.node }} - - - name: Download build files - uses: actions/download-artifact@v3 - with: - name: build-artifacts - - - name: Download local registry files - uses: actions/download-artifact@v3 - with: - name: local-registry - - - name: Install dependencies - run: npm install -g verdaccio - - - name: Run local npm registry - run: ./scripts/local-registry.sh & - - - name: Test package - run: npm run test:package -- -t ${{ matrix.webpack }} - working-directory: packages/webpack-plugin - - test-package-rollup-plugin: - needs: - - build - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - node: [16] - runs-on: ${{ matrix.os }} - name: rollup plugin ${{ matrix.os }} nodejs ${{ matrix.node }} - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js - uses: actions/setup-node@v3.8.1 - with: - node-version: ${{ matrix.node }} - - - name: Download build files - uses: actions/download-artifact@v3 - with: - name: build-artifacts - - - name: Download local registry files - uses: actions/download-artifact@v3 - with: - name: local-registry - - - name: Install dependencies - run: npm install -g verdaccio - - - name: Run local npm registry - run: ./scripts/local-registry.sh & - - - name: Test package - run: npm run test:package - working-directory: packages/rollup-plugin - tests: needs: - lint - test-unit - test-e2e - test-package-cli - - test-package-webpack-plugin - - test-package-rollup-plugin runs-on: ubuntu-latest steps: - run: echo "Tests done." diff --git a/packages/cli/test/package/cli.test.js b/packages/cli/test/package/cli.test.js index b393cf950a..65ad39f375 100644 --- a/packages/cli/test/package/cli.test.js +++ b/packages/cli/test/package/cli.test.js @@ -120,7 +120,7 @@ describe('CLI', () => { expect(stdout).toContain('[SUCCESS] Save reports'); }); - test('should generate report with custom relative baseline filepath', async () => { + test.only('should generate report with custom relative baseline filepath', async () => { // prime relative custom baseline const baselineCustomRelativeDirectory = path.join('dist', baselineCustomDirectory); const baselineCustomRelativeFilepath = path.join('dist', baselineCustomFilepath); @@ -131,10 +131,17 @@ describe('CLI', () => { baselineCustomRelativeFilepath, ); + console.log({ + baselineCustomRelativeDirectory, + baselineCustomRelativeFilepath, + }); + const { stdout } = await exec( `npx bundle-stats --compare --baseline --baseline-filepath ${baselineCustomFilepath} ../../__fixtures__/webpack-stats.current.json`, ); + console.log(stdout); + const htmlReport = await fs.readFile('dist/bundle-stats.html', 'utf8'); expect(htmlReport).toContain('Bundle Size — 2MiB (-3.11%). - BundleStats'); From d400c118385563bf50cc26536f60ddf3d6222f1c Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 14 Sep 2023 20:59:28 +0200 Subject: [PATCH 3/9] DROP: debug test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90505bc895..bafbf9ec0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,9 +3,9 @@ on: push: branches: - master + - fix-baseline-write tags: - v* - pull_request: jobs: build: From b3bdd371584339a6521e4cf1faa1bf812b8ed0cc Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 21 Sep 2023 17:54:35 +0200 Subject: [PATCH 4/9] DROP: debug test --- packages/cli/src/run.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index 59fd7cb26a..42ed4adf52 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -65,8 +65,8 @@ export default async function run(options: RunOptions): Promise { const baselinePath = getBaselineRelativePath(process.cwd(), '', baselineAbsolutePath); console.log({ - dirname: __dirname, - cwd: process.cwd(), + dirname: __dirname || '__dirname__ is missing', + cwd: process.cwd() || 'process.cwd is empty', baselineAbsolutePath, baselinePath, }); From 5e3f43ad8257638e3d40d1b6ddbbaafa39a48b9e Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 21 Sep 2023 22:18:58 +0200 Subject: [PATCH 5/9] DROP: debug test --- packages/cli/test/package/cli.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/test/package/cli.test.js b/packages/cli/test/package/cli.test.js index 65ad39f375..2f7f722fa1 100644 --- a/packages/cli/test/package/cli.test.js +++ b/packages/cli/test/package/cli.test.js @@ -128,10 +128,12 @@ describe('CLI', () => { await fs.mkdir(baselineCustomRelativeDirectory, { recursive: true }); await fs.copyFile( '../../__fixtures__/webpack-stats.baseline.json', - baselineCustomRelativeFilepath, + path.join(__dirname, baselineCustomRelativeFilepath), ); console.log({ + dirname: __dirname || '__dirname__ is missing', + cwd: process.cwd() || 'process.cwd is empty', baselineCustomRelativeDirectory, baselineCustomRelativeFilepath, }); From 308407c37bfc56ed98e01ff1e0389d59e4c82d8b Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 21 Sep 2023 22:33:18 +0200 Subject: [PATCH 6/9] DROP: debug test --- packages/cli/src/run.ts | 5 ++--- packages/cli/test/package/cli.test.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index 42ed4adf52..3e9d6c32e6 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -64,9 +64,8 @@ export default async function run(options: RunOptions): Promise { // Generate relative path relative to process.cwd() const baselinePath = getBaselineRelativePath(process.cwd(), '', baselineAbsolutePath); - console.log({ - dirname: __dirname || '__dirname__ is missing', - cwd: process.cwd() || 'process.cwd is empty', + console.log('RUN', { + cwd: process.cwd(), baselineAbsolutePath, baselinePath, }); diff --git a/packages/cli/test/package/cli.test.js b/packages/cli/test/package/cli.test.js index 2f7f722fa1..ce7e8c8396 100644 --- a/packages/cli/test/package/cli.test.js +++ b/packages/cli/test/package/cli.test.js @@ -125,14 +125,13 @@ describe('CLI', () => { const baselineCustomRelativeDirectory = path.join('dist', baselineCustomDirectory); const baselineCustomRelativeFilepath = path.join('dist', baselineCustomFilepath); - await fs.mkdir(baselineCustomRelativeDirectory, { recursive: true }); + await fs.mkdir(path.join(__dirname, baselineCustomRelativeDirectory), { recursive: true }); await fs.copyFile( '../../__fixtures__/webpack-stats.baseline.json', path.join(__dirname, baselineCustomRelativeFilepath), ); - console.log({ - dirname: __dirname || '__dirname__ is missing', + console.log('TEST', { cwd: process.cwd() || 'process.cwd is empty', baselineCustomRelativeDirectory, baselineCustomRelativeFilepath, From 5217a4be9b4d1566b322f394372729f7a2df41a4 Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 21 Sep 2023 22:34:20 +0200 Subject: [PATCH 7/9] DROP --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bafbf9ec0d..5c5471225b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -170,7 +170,7 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest] - node: [20, 18, 16, 14] + node: [14] runs-on: ${{ matrix.os }} name: CLI ${{ matrix.os }} nodejs ${{ matrix.node }} steps: From 5712824249fc91cd7ce3fdac9169d264112f0944 Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 21 Sep 2023 22:48:22 +0200 Subject: [PATCH 8/9] DROP --- packages/cli/src/cli.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 3b8a3acedf..5d736f2848 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -4,6 +4,7 @@ import yargs from 'yargs'; import updateNotifier from 'update-notifier'; import run from './run'; +import info from '../package.json'; const DEFAULT_OUTPUT_DIR = './dist'; const WEEK_IN_MS = 1000 * 60 * 60 * 24 * 7; @@ -35,6 +36,8 @@ export default async function cli(pkg: object) { return; } + console.info('CLI', info.version, info.name); + const args = yargs .usage('Usage: $0 OPTIONS [STATS_FILE]...') .demandCommand(1, 'Webpack stats file path is required.') From 3ead5f85d0dd7b11916578918e22b02cfe144526 Mon Sep 17 00:00:00 2001 From: Vio Date: Thu, 21 Sep 2023 22:56:12 +0200 Subject: [PATCH 9/9] DROP --- packages/cli/src/cli.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 5d736f2848..c3450ee802 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -4,6 +4,7 @@ import yargs from 'yargs'; import updateNotifier from 'update-notifier'; import run from './run'; +// @ts-ignore import info from '../package.json'; const DEFAULT_OUTPUT_DIR = './dist';