From ae4f67587ec4b4d28ef7284308f7ff0a566aa37b Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Sun, 15 Feb 2026 21:41:21 +0300 Subject: [PATCH 1/2] ci: add codecov and fix test --- .github/workflows/main.yml | 23 ++++++++++++----------- jest.config.js | 1 + package.json | 1 + test/Logger.js | 2 +- test/dev-server/webpack.config.js | 2 +- test/helpers.js | 2 +- test/parseUtils.js | 2 +- test/plugin.js | 2 +- test/statsUtils.js | 2 +- test/utils.js | 2 +- test/viewer.js | 4 ++-- 11 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fee51c1c..cfb8cbae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,35 +17,36 @@ jobs: name: Tests on Node.js v${{ matrix.node.version }} steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup node - uses: actions/setup-node@v6 + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{ matrix.node.version }} - - - name: Download deps - uses: bahmutov/npm-install@v1 + cache: npm - name: Build sources run: ${{ matrix.node.env }} npm run build - name: Run tests - run: ${{ matrix.node.env }} npm run test + run: ${{ matrix.node.env }} npm run test:coverage + + - name: Codecov + uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} lint: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v5 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup node - uses: actions/setup-node@v6 + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: "22.x" - - - name: Download deps - uses: bahmutov/npm-install@v1 + cache: npm - name: Build sources run: npm run build diff --git a/jest.config.js b/jest.config.js index 9e1aaa40..70a8c6f5 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,6 +8,7 @@ module.exports = { testMatch: ["**/test/*.js"], testPathIgnorePatterns: ["/test/helpers.js"], setupFilesAfterEnv: ["/test/helpers.js"], + coveragePathIgnorePatterns: ["/test"], watchPathIgnorePatterns: [ // Ignore the output generated by plugin tests // when watching for changes to avoid the test diff --git a/package.json b/package.json index fd973935..5f593ae0 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "fix": "npm run fix:code && npm run fmt", "install-test-webpack-versions": "./bin/install-test-webpack-versions.sh", "test": "npm run install-test-webpack-versions && NODE_OPTIONS=--openssl-legacy-provider jest --runInBand", + "test:coverage": "npm run test -- --coverage", "test-dev": "npm run install-test-webpack-versions && NODE_OPTIONS=--openssl-legacy-provider jest --watch --runInBand" }, "dependencies": { diff --git a/test/Logger.js b/test/Logger.js index 1e7d106c..14811644 100644 --- a/test/Logger.js +++ b/test/Logger.js @@ -1,4 +1,4 @@ -const Logger = require("../lib/Logger"); +const Logger = require("../src/Logger"); class TestLogger extends Logger { constructor(level) { diff --git a/test/dev-server/webpack.config.js b/test/dev-server/webpack.config.js index 45327b60..c323bf74 100644 --- a/test/dev-server/webpack.config.js +++ b/test/dev-server/webpack.config.js @@ -1,7 +1,7 @@ "use strict"; const path = require("node:path"); -const BundleAnalyzerPlugin = require("../../lib/BundleAnalyzerPlugin"); +const BundleAnalyzerPlugin = require("../../src/BundleAnalyzerPlugin"); module.exports = { mode: "development", diff --git a/test/helpers.js b/test/helpers.js index ca8f5980..a238b7a0 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -2,7 +2,7 @@ const { readdirSync } = require("node:fs"); const path = require("node:path"); const webpack = require("webpack"); -const BundleAnalyzerPlugin = require("../lib/BundleAnalyzerPlugin"); +const BundleAnalyzerPlugin = require("../src/BundleAnalyzerPlugin"); /* global it */ diff --git a/test/parseUtils.js b/test/parseUtils.js index 5bb1b884..c36b2ddb 100644 --- a/test/parseUtils.js +++ b/test/parseUtils.js @@ -1,7 +1,7 @@ const fs = require("node:fs"); const path = require("node:path"); -const { parseBundle } = require("../lib/parseUtils"); +const { parseBundle } = require("../src/parseUtils"); const BUNDLES_DIR = path.resolve(__dirname, "./bundles"); diff --git a/test/plugin.js b/test/plugin.js index db4b0fe4..1a4350f7 100644 --- a/test/plugin.js +++ b/test/plugin.js @@ -2,7 +2,7 @@ const fs = require("node:fs"); const path = require("node:path"); const url = require("node:url"); const puppeteer = require("puppeteer"); -const BundleAnalyzerPlugin = require("../lib/BundleAnalyzerPlugin"); +const BundleAnalyzerPlugin = require("../src/BundleAnalyzerPlugin"); const { isZstdSupported } = require("../src/sizeUtils"); const { forEachWebpackVersion, diff --git a/test/statsUtils.js b/test/statsUtils.js index d305a674..88b68095 100644 --- a/test/statsUtils.js +++ b/test/statsUtils.js @@ -1,7 +1,7 @@ const { readFileSync } = require("node:fs"); const path = require("node:path"); const { globSync } = require("tinyglobby"); -const { StatsSerializeStream } = require("../lib/statsUtils"); +const { StatsSerializeStream } = require("../src/statsUtils"); async function stringify(json) { return new Promise((resolve, reject) => { diff --git a/test/utils.js b/test/utils.js index 56ee626a..46d56d63 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,4 +1,4 @@ -const { createAssetsFilter } = require("../lib/utils"); +const { createAssetsFilter } = require("../src/utils"); describe("createAssetsFilter", () => { it("should create a noop filter if pattern is not set", () => { diff --git a/test/viewer.js b/test/viewer.js index 5d355eaa..98ff7533 100644 --- a/test/viewer.js +++ b/test/viewer.js @@ -1,8 +1,8 @@ const crypto = require("node:crypto"); const net = require("node:net"); -const Logger = require("../lib/Logger"); -const { getEntrypoints, startServer } = require("../lib/viewer"); +const Logger = require("../src/Logger"); +const { getEntrypoints, startServer } = require("../src/viewer"); describe("WebSocket server", () => { it("should not crash when an error is emitted on the websocket", (done) => { From a69b51c7f68e90d1841c547bc32d78a65a2964ce Mon Sep 17 00:00:00 2001 From: alexander-akait Date: Sun, 15 Feb 2026 21:44:20 +0300 Subject: [PATCH 2/2] ci: fix --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfb8cbae..777b97b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,6 +25,9 @@ jobs: node-version: ${{ matrix.node.version }} cache: npm + - name: Install dependencies + run: npm ci + - name: Build sources run: ${{ matrix.node.env }} npm run build @@ -48,6 +51,9 @@ jobs: node-version: "22.x" cache: npm + - name: Install dependencies + run: npm ci + - name: Build sources run: npm run build