Repository navigation
test: compare CSS declarations regardless of order - #760
Conversation
webpack 5.112's CSS minimizer emits declarations in a different order, so the two embedded-source tests that compared the stylesheet verbatim failed on the rows that install webpack@latest (Node 10/12/14). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QYPkbvwyRWt2SHgXDoYRdo
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #760 +/- ##
=======================================
Coverage 97.67% 97.67%
=======================================
Files 5 5
Lines 1718 1718
Branches 664 664
=======================================
Hits 1678 1678
Misses 39 39
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe test file adds a helper that sorts semicolon-separated declarations in a single-rule stylesheet while preserving its selector. Two nested-payload tests use the helper to sort actual and expected CSS before comparing them. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
Summary
webpack 5.112.0 (Oct 15) changed the order its CSS minimizer emits declarations in:
.a{color:red;background:url(…)}instead of.a{background:url(…);color:red}. Two tests intest/embedded-source.test.jscompared the minified stylesheet verbatim, so they now fail.Only the Node 10/12/14 rows hit it. Their npm can't read the v3 lockfile and installs
webpack@latest. The other rows stay on the locked 5.109.2, where this file is skipped (it needs webpack ≥ 5.110).mainis affected the same way; it shows up on every PR, e.g. #756.Change
The two tests check that the
data:payload inside the stylesheet is (or isn't) minified, not the declaration order. They now compare the stylesheet with its declarations sorted.Tests
test/embedded-source.test.jspasses against webpack 5.111.1 and 5.112.0 (20/20 on each). Lint, Prettier and cspell pass.Generated by Claude Code
Summary by CodeRabbit