W-23517830: Add isolated-process test for bad-library-path initialization in the DataWeave Node.js binding#134
Merged
Conversation
Cover the bad-library-path initialize() case that could not be asserted in the shared integration lane. A bad/nonexistent dwlib path makes initialize() throw a DataWeaveError only as the FIRST native init in a process (the runtime is loaded process-globally / ref-counted), so this runs in a dedicated child process — order- and vitest-pool-independent. - tests/integration/fixtures/bad-lib-init.cjs: child fixture that requires the built dist/ entry, asserts the DataWeaveError, and signals via stdout sentinel + exit code (a no-throw / wrong-error / native crash all surface as a non-zero child exit). - tests/integration/init-bad-path.test.ts: spawns the fixture with execFileSync (throws on non-zero exit) and asserts the OK sentinel; guards on the built entry existing with a clear message. - edge-cases.test.ts: update the NOTE to point at the new test instead of describing it as an open follow-up. Verified: tsc clean, 70 unit tests pass, 35 integration tests pass (deterministic across repeated runs) against the real native library. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
andres-rad
approved these changes
Jul 21, 2026
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.
What
A bad/nonexistent
dwlibpath makesinitialize()throw aDataWeaveErroronly as the first native init in a process — the runtime is loaded process-globally / ref-counted, so once any good init has run, a later bad-path init is tolerated. That made it order-dependent (flaky) in the shared lane.Approach
Run it in a dedicated child process, making it order- and vitest-pool-independent:
tests/integration/fixtures/bad-lib-init.cjs— child fixture that requires the builtdist/entry, asserts theDataWeaveError, and signals via stdout sentinel + exit code (no-throw / wrong-error / native crash all surface as a non-zero child exit).tests/integration/init-bad-path.test.ts— spawns the fixture withexecFileSync(throws on non-zero exit) and asserts theOK:DataWeaveErrorsentinel; guards on the built entry existing.edge-cases.test.ts— NOTE updated to point at the new test.Testing
tsc --noEmitcleannpm run test:unit→ 70 passednpm run test:integration→ 35 passed, deterministic across repeated runs🤖 Generated with Claude Code