You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: cover devMiddleware.writeToDisk with output.clean - #5802
Each case runs in both modes: as a server of its own (new Server(options, compiler)) and as a plugin (server.apply(compiler)).
With devMiddleware.writeToDisk: (p) => !p.endsWith(".svg"), on a middleware that cleans the disk:
the first build leaves [main.<hash>.js, robots.txt], so the stale file is cleaned;
logo.svg is served from memory and kept off disk;
a rebuild with a new hash leaves one bundle;
removing public/robots.txt cleans it from disk.
With writeToDisk: true and a file system of your own in memory, given in devMiddleware.outputFileSystem or set on the compiler:
the files are written to disk and to it, and served from it;
after a rebuild, both hold the one new bundle.
On an earlier middleware: the files are written, and nothing is cleaned.
The tests check which case applies from the middleware alone: whether it gives the compiler a file system of its own. A next-major TODO is left to drop that check. Locally, everything passes in both modes:
against the released middleware, the earlier-middleware case runs and the others are skipped;
Cover both the server of its own and the plugin mode: the stale file and
the previous bundle are cleaned from disk, a file no longer copied is
removed, and what `writeToDisk` leaves out is served from memory only.
Where webpack-dev-middleware does not clean the disk yet, check that the
files are written without cleaning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
No actionable comments were generated in the recent review.
Walkthrough
Adds end-to-end tests for devMiddleware.writeToDisk with webpack’s output.clean in standalone-server and plugin modes. The tests cover stale-file cleanup, excluded SVG handling, bundle replacement, and deleted copied-file cleanup across rebuilds. They also check separate memory filesystem configurations and the older middleware behavior.
Merge Risk: Minimal · up to 8022b
This change only adds end-to-end tests for write-to-disk cleaning and a test port mapping. It has no production impact, and no merge-blocking risk is identified.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "test: cover devMiddleware.writeToDisk with output.clean" matches the main change. The PR adds end-to-end tests for devMiddleware.writeToDisk combined with output.clean, plus a ports-map ent…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "test: cover devMiddleware.writeToDisk with output.clean" matches the main change. The PR adds end-to-end tests for devMiddleware.writeToDisk combined with output.clean, plus a ports-map entry for the new test. The title is specific, short, and uses the conventional test: prefix. It does not cover every detail, such as the in-memory filesystem case or the capability-based skip logic, which is acceptable.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 57359a75-072b-4e19-b1d0-b0d7e2317b69
Commits
Reviewing files that changed from the base of the PR and between 89dd1bb and 8022b30.
Files selected for processing: 1
test/e2e/write-to-disk-clean.test.js
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 944d2da6-ec2b-4cc0-af17-f899d035a1f2
Commits
Reviewing files that changed from the base of the PR and between bb2680f and 78dae08.
Files selected for processing: 2
test/e2e/write-to-disk-clean.test.js
test/ports-map.js
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
A build restarted for a change keeps the startTime it began with, so it
could be taken for the build before the change and never awaited.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
In both modes, with `writeToDisk: true` and a file system in memory given
in `devMiddleware.outputFileSystem` or set on the compiler, the files are
written to disk and to it, served from it, and both are cleaned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
memfs lists recursively with the full path on Windows, so the files were
looked up under the output directory twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
Test - macos-latest - Node v26.x failed on 8022b30 in test/e2e/logging.test.js ("should work and do not log messages about hot and live reloading is enabled (ws)"): Puppeteer's Network.enable timed out while opening the page, after 181 s. That file isn't in this PR's diff. The new ports-map entry is appended last, so no other test's port moves, and write-to-disk-clean.test.js passed in the same job. The Ubuntu, Windows, macOS Node v22 and lint jobs passed. macOS Node v24 hadn't finished, and I've re-run the failed jobs once to confirm.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This adds tests through webpack-dev-server for webpack/webpack-dev-middleware#861, fixed in webpack/webpack-dev-middleware#2497. The project uses:
output.clean: true;output.copyfrompublic/;dist/stale.js.Each case runs in both modes: as a server of its own (
new Server(options, compiler)) and as a plugin (server.apply(compiler)).devMiddleware.writeToDisk: (p) => !p.endsWith(".svg"), on a middleware that cleans the disk:[main.<hash>.js, robots.txt], so the stale file is cleaned;logo.svgis served from memory and kept off disk;public/robots.txtcleans it from disk.writeToDisk: trueand a file system of your own in memory, given indevMiddleware.outputFileSystemor set on the compiler:The tests check which case applies from the middleware alone: whether it gives the compiler a file system of its own. A next-major TODO is left to drop that check. Locally, everything passes in both modes:
This changes only tests:
test/e2e/write-to-disk-clean.test.jsand atest/ports-map.jsentry. There is no code change and no changeset.🤖 Generated with Claude Code
https://claude.ai/code/session_01UjuMAuk9o6UazjHzcAQCTA
Summary by CodeRabbit