@W-23513166: Introduce unit testing for the Node.js binding#129
Merged
Conversation
…inding Establish a three-group vitest layout for the @dataweave/native Node.js binding — unit (no dwlib), integration (requires dwlib), and tck (runtime conformance) — all feeding one merged v8 coverage report over src/**. This delivers Group A (unit tests); B and C are scaffolded only. - Migrate vitest to a 3-project layout with passWithNoTests for incremental rollout; coverage over src/** (ffi.ts excluded as a thin addon wrapper). - Extract pure parsing logic to src/result.ts so response/streaming parsing is unit-testable without the native addon. - Move the existing E2E suite into tests/integration/. - Add 35 unit tests (tests/unit/result.test.ts, tests/unit/utils.test.ts) covering input encoding, response parsing, and library discovery. - Add test:unit/:integration/:tck/:coverage/:coverage:unit scripts and @vitest/coverage-v8; gitignore coverage/. - Add TSDoc to result.ts, utils.ts, and types.ts; drop the unused StreamOutput. - build.gradle: replace deprecated buildDir with getLayout().getBuildDirectory(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
getLayout().getBuildDirectory() returns a lazy DirectoryProperty, not a File; interpolating it into a GString produced a literal "property(...FixedDirectory...)" path. On Windows this made the strip task's workingDir invalid (CreateProcess error=267), breaking the CI build. Use layout.buildDirectory.get().asFile to get the resolved File. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
martincousido
approved these changes
Jul 20, 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
Introduces a unit-testing foundation for the
@dataweave/nativeNode.js binding (native-lib/node).Establishes a three-group vitest layout, all feeding one merged v8 coverage report over
src/**:dwlib?tests/unit/tests/integration/tests/tck/This PR delivers Group A (unit tests) only; B and C are scaffolded and land in follow-up stories.
Changes
passWithNoTestsfor incremental rollout; coverage oversrc/**(ffi.tsexcluded as a thin native-addon wrapper).src/result.tsso response/streaming parsing is unit-testable without the native addon.tests/integration/.tests/unit/result.test.ts,tests/unit/utils.test.ts) covering input encoding, response parsing, and library discovery.test:unit/:integration/:tck/:coverage/:coverage:unitscripts +@vitest/coverage-v8; gitignorecoverage/.result.ts,utils.ts,types.ts; remove the unusedStreamOutputinterface.build.gradle: replace deprecatedbuildDirwithgetLayout().getBuildDirectory().Testing
npm run test:unit→ 35 passed. Coverage:result.ts100%,utils.ts~91%.Follow-ups (separate stories)
index.ts.tcklane.🤖 Generated with Claude Code