Skip to content

test: reuse ffi.suffix instead of reimplementing it - #64840

Open
leah-1ee wants to merge 1 commit into
nodejs:mainfrom
leah-1ee:test-ffi-suffix-assertions
Open

test: reuse ffi.suffix instead of reimplementing it#64840
leah-1ee wants to merge 1 commit into
nodejs:mainfrom
leah-1ee:test-ffi-suffix-assertions

Conversation

@leah-1ee

Copy link
Copy Markdown

ffi-test-common.js re-implemented the same branch that ffi.suffix
already exposes, risking drift from lib/ffi.js. test-ffi-module.js
only checked the key exists, not its value.

  • Use ffi.suffix in ffi-test-common.js instead of re-implementing it
  • Assert ffi.suffix matches the expected value per platform

Related to #64805 (same fix for the docs)

ffi-test-common.js duplicated the platform branch already exposed
as ffi.suffix, risking drift if lib/ffi.js changes. Reuse it, and
require it after skipIfFFIMissing() so a build without FFI skips
instead of throwing.

Also assert ffi.suffix resolves to the correct value per platform,
since test-ffi-module.js only checked that the key exists.

Signed-off-by: leah-1ee <dltjddms1028@gmail.com>
Copilot AI review requested due to automatic review settings July 30, 2026 08:22
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/ffi

@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 Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes duplicated platform-specific FFI library-suffix logic from the FFI test helpers by reusing the canonical ffi.suffix export, and strengthens test coverage by asserting the suffix value matches the current platform.

Changes:

  • Replaced ad-hoc platform branching in test/ffi/ffi-test-common.js with require('node:ffi').suffix.
  • Added a dedicated test asserting ffi.suffix is dll/dylib/so based on process.platform.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
test/ffi/test-ffi-module.js Adds an explicit assertion that ffi.suffix matches the expected platform-specific extension.
test/ffi/ffi-test-common.js Uses the canonical ffi.suffix when building the fixture library path to avoid drift from lib/ffi.js.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.15%. Comparing base (e7904d4) to head (ba2d10f).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64840      +/-   ##
==========================================
+ Coverage   90.14%   90.15%   +0.01%     
==========================================
  Files         746      746              
  Lines      242764   242764              
  Branches    45739    45741       +2     
==========================================
+ Hits       218848   218876      +28     
+ Misses      15426    15379      -47     
- Partials     8490     8509      +19     

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

@daeyeon daeyeon added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 30, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 31, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

6 participants