Repository navigation
fix: resolve relative paths in unloadFile against the working directory - #6468
Closed
RaphaelFakhri wants to merge 1 commit into
Closed
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
|
Contributor
Automation signalsActivity patterns show signs of automation. Evidence
Last 5 PRs:
This is an automated analysis by AgentScan |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Checklist
status: accepting prsOverview
Mocha#loadFilesresolves each file withpath.resolve(), so relative paths are relative to the current working directory.Mocha.unloadFilepasses the path straight to arequire.resolvecreated inlib/nodejs/, so a relative path resolves from there instead. Since #6355, the resultingMODULE_NOT_FOUNDis swallowed, so the file silently stays in therequirecache and the next run registers no tests:This change resolves the path with
path.resolve()beforerequire.resolve(), matchingloadFiles. Absolute paths, which watch mode uses, are unchanged.A new unit test in
test/node-unit/mocha.spec.cjsunloads a file by its cwd-relative path. It fails without the fix and passes with it.npm run test-node:unitand the watch integration tests pass.This picks up the fix from #4549 and #6259, which were closed before review.