Skip to content

Conversation

@IlyasShabi
Copy link
Contributor

Add test for implicit fs calls with await using syntax

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Dec 21, 2025
@IlyasShabi IlyasShabi requested a review from aduh95 December 21, 2025 14:40
@IlyasShabi IlyasShabi marked this pull request as ready for review December 21, 2025 14:47
@codecov
Copy link

codecov bot commented Dec 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (4f24aff) to head (a31f2f7).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61140      +/-   ##
==========================================
- Coverage   88.53%   88.53%   -0.01%     
==========================================
  Files         703      703              
  Lines      208546   208545       -1     
  Branches    40217    40225       +8     
==========================================
- Hits       184634   184626       -8     
+ Misses      15926    15917       -9     
- Partials     7986     8002      +16     

see 47 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Renegade334
Copy link
Member

Should we be waiting until ERM is no longer flagged in V8 to start introducing these?

@LiviaMedeiros LiviaMedeiros added dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. labels Dec 22, 2025
Copy link
Member

@LiviaMedeiros LiviaMedeiros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unflagged on v24.x and beyond, so it should be fine to land with appropriate dont-land-on-*s.

async function implicitCall() {
{
await using fh = await fs.open(__filename);
fh.on('close', common.mustCall());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures only that fh is closed at some point, but we need to test that the filehandle is closed as soon as we exit the scope.

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

Labels

dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants