test: replace content hashes and full hashes to placeholders in css extract plugin cases #9398
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
don't want to flush hashes in plugin tests anymore
This pull request includes multiple changes to the
tests/plugin-test/css-extract/TestCases.test.js
file and several other test files to improve the handling and comparison of hashes in test cases. The most important changes include the addition of functions to normalize paths and retrieve hashes, modifications to thecompareDirectory
function to handle hashes, and updates to expected test output files to use placeholders for hashes.Improvements to hash handling in tests:
tests/plugin-test/css-extract/TestCases.test.js
: Added functionsnormalizePath
,getHashes
,recoveryHash
, andremoveHash
to handle and compare hashes in test cases. ModifiedcompareDirectory
to use these functions for comparing directories with hashes. [1] [2] [3]Updates to expected test output files:
tests/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.js
: Replaced hardcoded full hash with placeholder__FULL_HASH__
.tests/plugin-test/css-extract/cases/es-named-export-as-is-output-module/expected/main.css
andmain.mjs
: Updated class names to use new placeholders. [1] [2]tests/plugin-test/css-extract/cases/es-named-export-as-is/expected/main.css
andmain.js
: Updated class names to use new placeholders. [1] [2]tests/plugin-test/css-extract/cases/hmr-locals/expected/main.css
andmain.js
: Updated class names and full hash placeholders. [1] [2] [3]tests/plugin-test/css-extract/cases/hmr/expected/main.js
: Updated full hash placeholder.tests/plugin-test/css-extract/cases/issue-6649/expected/main.js
: Replaced hardcoded content hashes and full hash with placeholders. [1] [2]tests/plugin-test/css-extract/cases/js-hash/expected/style.$8f598b234f360ef39d24$.1.css
: Removed redundant CSS rules.Changes to hash function and digest length:
tests/plugin-test/css-extract/TestCases.test.js
: Changed hash function frommd4
toxxhash64
and updated hash digest length from 20 to 16. [1] [2]Checklist