Skip to content

fix: keep the path case of changed files on Windows - #2286

Open
kaanisthatyou wants to merge 1 commit into
remy:mainfrom
kaanisthatyou:fix/windows-restart-file-case
Open

kaanisthatyou wants to merge 1 commit into
remy:mainfrom
kaanisthatyou:fix/windows-restart-file-case

Conversation

@kaanisthatyou

Copy link
Copy Markdown

On Windows, match() lowercased the first character of every matched path:

if (utils.isWindows) {
  // fix for windows testing - I *think* this is okay to do
  result = result.map(function (file) {
    return file.slice(0, 1).toLowerCase() + file.slice(1);
  });
}

This undoes the drive letter normalisation that watch.js applies right before calling match() (c:\foo -> C:\foo), so the files emitted with the restart event have a lowercase drive letter and don't compare equal to path.resolve() / process.cwd() based paths.

Reproduction on Windows 11 / Node 24.14.0, using the required API from doc/requireable.md:

nodemon({ script: 'Src/App.js', watch: ['Src'], ext: 'js' })
  .on('restart', files => console.log(files));
// before: [ 'c:\\...\\nm-repro\\Src\\App.js' ]
// after:  [ 'C:\\...\\nm-repro\\Src\\App.js' ]

The existing tests already cover this on Windows. Running each test file as npm run spec does (in Git Bash):

test file before after
test/monitor/match.test.js 29 passing, 4 failing 33 passing
test/monitor/watch-restart.test.js 1 passing, 3 failing 4 passing
test/events/complete.test.js 4 passing, 1 failing 5 passing

All other test files have the same results before and after. On Linux and macOS the removed code was a no-op because absolute paths start with /, so behaviour there is unchanged. For the same reason a test for this cannot fail on the current Linux-only CI.

The remaining Windows failures (fork/run, rules/index, events/scripts, misc/sigint, config/load-logging) are unrelated; happy to look at those separately, since CONTRIBUTING mentions help with Windows tests is wanted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XvSbVkca8tLnsnVVNKUQHQ

match() lowercased the first character of every matched path on Windows,
which undid the drive letter normalisation in watch.js (c:\ -> C:\), so
the files passed to the 'restart' event no longer matched path.resolve().

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XvSbVkca8tLnsnVVNKUQHQ
@netlify

netlify Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for nodemon ready!

Name Link
🔨 Latest commit b0512f4
🔍 Latest deploy log https://app.netlify.com/projects/nodemon/deploys/6aa6be12fc312e00082469f4
😎 Deploy Preview https://deploy-preview-2286--nodemon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant