Skip to content

test: prefer common/tmpdir over os.tmpdir() - #67567

Merged
nodejs-github-bot merged 3 commits into
nodejs:mainfrom
LiviaMedeiros:test-please-no-ostmpdir
Nov 20, 2026
Merged

nodejs-github-bot merged 3 commits into
nodejs:mainfrom
LiviaMedeiros:test-please-no-ostmpdir

Conversation

@LiviaMedeiros

Copy link
Copy Markdown
Member

We should avoid using OS's tmpdir in tests when possible. This PR:

  • adds Temporary files part to the writing tests guide, making common/tmpdir more visible and explicitly recommended
  • adds and applies linter rule restricting os.tmpdir() usage

Any suggestions on improving the lint rule are welcome. It's not panacea and my vision of follow-up is vague for now, but i think it would be feasible to add mkdtemp/mkstemp-alike sugar to common/tmpdir.

Signed-off-by: LiviaMedeiros <livia@cirno.name>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Nov 18, 2026
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.71%. Comparing base (3ea9547) to head (db4333f).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67567      +/-   ##
==========================================
- Coverage   90.71%   90.71%   -0.01%     
==========================================
  Files         801      801              
  Lines      280705   280794      +89     
  Branches    54168    54195      +27     
==========================================
+ Hits       254640   254711      +71     
- Misses      16247    16248       +1     
- Partials     9818     9835      +17     

see 44 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.

@LiviaMedeiros LiviaMedeiros added test Issues and PRs related to Node.js core tests and test infrastructure. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 18, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 18, 2026
@nodejs-github-bot

This comment was marked as outdated.

@panva panva added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Nov 18, 2026
Comment thread doc/contributing/writing-tests.md Resolved
Co-authored-by: Luigi Pinca <luigipinca@gmail.com>
@LiviaMedeiros LiviaMedeiros added the commit-queue-squash PRs the Commit Queue should land as one squashed commit. label Nov 18, 2026
@nodejs-github-bot

This comment was marked as outdated.

Signed-off-by: LiviaMedeiros <livia@cirno.name>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@LiviaMedeiros LiviaMedeiros added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 19, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 0482448 into nodejs:main Nov 20, 2026
60 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 0482448

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 20, 2026
aduh95 pushed a commit that referenced this pull request Nov 20, 2026
Signed-off-by: LiviaMedeiros <livia@cirno.name>
PR-URL: #67567
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-squash PRs the Commit Queue should land as one squashed commit. needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants