ci: rearchitect link validation caching to work at the URL level and support content/… #6263
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.
…shared shared content files. Fix the cache reporting.Link Validation Cache Performance:
=======================================
Cache hit rate: 100%
Cache hits: 54
Cache misses: 0
Total validations: 54
New entries stored: 0
✨ Cache optimization saved 54 link validations
This demonstrates that all 54 link validations were served from cache, which
greatly speeds up the test execution.
Summary
I've successfully fixed the cache statistics reporting issue in the Cypress link
validation tests. Here's what was implemented:
Changes Made:
- Added a new task call saveCacheStatsForReporter in the after() hook to save cache statistics to a file that the main reporter can read
- Added the saveCacheStatsForReporter task that calls the reporter's saveCacheStats function
- Imported the saveCacheStats function from the link reporter
- Improved the displayBrokenLinksReport function to show comprehensive cache performance statistics
- Added better formatting and informative messages about cache optimization benefits
- Added the missing HUGO_SHUTDOWN_TIMEOUT constant and exported it
- Updated the import in run-e2e-specs.js to include this constant
Result:
The cache statistics are now properly displayed in the terminal output after
running link validation tests, showing: