Skip to content

Commit e8ab6af

Browse files
committed
test: split css minimizer tests into a separate file excluded by jest config
`it.skip`-ing the css-minimizer rows still left orphan snapshots in the shared snapshot file, which made some CI rows fail when those snapshots weren't reconciled. Move all of them into a dedicated `test/css-minify-option.test.js` (with its own snapshot file) and add a `testPathIgnorePatterns` entry in `jest.config.js` that drops that file entirely on rows where the CSS deps don't run — Node <18 or Windows. Removes the now-unneeded continue-on-error / fail-fast overrides from the workflow.
1 parent 5fd772a commit e8ab6af

6 files changed

Lines changed: 559 additions & 606 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,13 @@ jobs:
6565
name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}
6666

6767
strategy:
68-
fail-fast: false
6968
matrix:
7069
os: [ubuntu-latest, windows-latest, macos-latest]
7170
node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x, 22.x, 24.x]
7271
webpack-version: [latest]
7372

7473
runs-on: ${{ matrix.os }}
7574

76-
# The bundled CSS minimizers (`@swc/css`, `lightningcss`, `esbuild`,
77-
# `cssnano@7`) require modern Node and don't reliably install on
78-
# the Windows agents. Let the rows that exercise them run for
79-
# visibility, but don't gate the workflow on them — only ubuntu
80-
# and macOS at Node 18+ are required to pass.
81-
continue-on-error: >-
82-
${{
83-
matrix.os == 'windows-latest'
84-
|| matrix.node-version == '10.x'
85-
|| matrix.node-version == '12.x'
86-
|| matrix.node-version == '14.x'
87-
|| matrix.node-version == '16.x'
88-
}}
89-
9075
concurrency:
9176
group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.webpack-version }}-${{ github.ref }}
9277
cancel-in-progress: true

jest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
// The bundled CSS minimizers (`cssnano@7`, `@swc/css`, `lightningcss`,
2+
// `esbuild@0.27`) require modern Node and don't reliably install on the
3+
// Windows agents. Skip the dedicated CSS test file outright on rows that
4+
// can't run them so we don't end up with stale or missing snapshots.
5+
const NODE_MAJOR = Number(process.versions.node.split(".")[0]);
6+
const IS_WINDOWS = process.platform === "win32";
7+
const RUN_CSS_TESTS = NODE_MAJOR >= 18 && !IS_WINDOWS;
8+
19
module.exports = {
210
testEnvironment: "node",
311
coveragePathIgnorePatterns: ["src/serialize-javascript.js"],
12+
testPathIgnorePatterns: RUN_CSS_TESTS
13+
? []
14+
: ["/test/css-minify-option\\.test\\.js$"],
415
};

0 commit comments

Comments
 (0)