test: capture negative utimes mtime at call time#62490
Open
inoway46 wants to merge 1 commit intonodejs:mainfrom
Open
test: capture negative utimes mtime at call time#62490inoway46 wants to merge 1 commit intonodejs:mainfrom
inoway46 wants to merge 1 commit intonodejs:mainfrom
Conversation
Contributor
Author
|
I noticed this in my current PR. #62471 (comment) The same failure has shown up twice recently on |
inoway46
commented
Mar 29, 2026
| // Negative numeric timestamps are normalized to "now" at call time. | ||
| return fs._toUnixTimestamp(mtime); | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
This helper is optional and I can inline it if preferred.
I kept it as a helper because the key point is to capture the expected mtime at call time before each invocation, and I thought naming that step made the intent clearer.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62490 +/- ##
==========================================
- Coverage 91.55% 89.71% -1.84%
==========================================
Files 351 692 +341
Lines 147653 213986 +66333
Branches 23224 41052 +17828
==========================================
+ Hits 135179 191982 +56803
- Misses 12217 14086 +1869
- Partials 257 7918 +7661 🚀 New features to boost your workflow:
|
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.
test-fs-utimesrecalculates the expectedmtimeduring assertion.For negative numeric timestamps such as
-1, Node normalizes the value to the current time at call time. Recomputing the expectation later can let it drift past the test's 2-second tolerance and cause a false failure.This change captures the expected
mtimeimmediately before eachutimes/lutimes/futimescall and reuses it for the assertion.Background: #62490 (comment)
Refs: #37692