Skip to content

chore: consolidate --import flags into a single globals.js#58

Open
kraenhansen wants to merge 1 commit intomainfrom
kh/refactor-globals-import
Open

chore: consolidate --import flags into a single globals.js#58
kraenhansen wants to merge 1 commit intomainfrom
kh/refactor-globals-import

Conversation

@kraenhansen
Copy link
Copy Markdown
Member

@kraenhansen kraenhansen commented Apr 25, 2026

Summary

  • Introduce implementors/node/globals.js that imports all five global setup modules (features, assert, load-addon, gc, must-call). Using imports in the harness code is fine.
  • Replace five separate --import flags in runFileInSubprocess with a single --import of globals.js
  • Makes it easier to add new globals in the future

Test plan

  • npm run node:test passes (same results as before — only pre-existing failures from unbuilt addons)

🤖 Generated with Claude Code

Replace five separate --import flags in the test subprocess with a
single globals.js that re-exports all global setup modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kraenhansen kraenhansen self-assigned this Apr 25, 2026
@kraenhansen kraenhansen moved this from Need Triage to In Progress in Node-API Team Project Apr 25, 2026
@kraenhansen kraenhansen requested a review from legendecas April 25, 2026 21:45
Copy link
Copy Markdown
Contributor

@bavulapati bavulapati left a comment

Choose a reason for hiding this comment

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

💯

const ROOT_PATH = path.resolve(import.meta.dirname, "..", "..");
const TESTS_ROOT_PATH = path.join(ROOT_PATH, "tests");
const FEATURES_MODULE_PATH = path.join(
const GLOBALS_MODULE_PATH = path.join(
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.

Can we call this harness module? Though it installs global functions, I would prefer calling it with it's purpose, not it's solution.

Suggested change
const GLOBALS_MODULE_PATH = path.join(
const HARNESS_MODULE_PATH = path.join(

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

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants