Skip to content

@W-23513166: Introduce unit testing for the Node.js binding#129

Merged
mlischetti merged 2 commits into
masterfrom
W-23513166-node-unit-testing
Jul 20, 2026
Merged

@W-23513166: Introduce unit testing for the Node.js binding#129
mlischetti merged 2 commits into
masterfrom
W-23513166-node-unit-testing

Conversation

@mlischetti

Copy link
Copy Markdown
Contributor

What

Introduces a unit-testing foundation for the @dataweave/native Node.js binding (native-lib/node).

Establishes a three-group vitest layout, all feeding one merged v8 coverage report over src/**:

Lane Directory Requires dwlib? Status
unit tests/unit/ No 35 tests, delivered here
integration tests/integration/ Yes existing E2E suite moved here
tck tests/tck/ Yes scaffolded (empty)

This PR delivers Group A (unit tests) only; B and C are scaffolded and land in follow-up stories.

Changes

  • Migrate vitest to a 3-project layout with passWithNoTests for incremental rollout; coverage over src/** (ffi.ts excluded as a thin native-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 + @vitest/coverage-v8; gitignore coverage/.
  • Add TSDoc to result.ts, utils.ts, types.ts; remove the unused StreamOutput interface.
  • build.gradle: replace deprecated buildDir with getLayout().getBuildDirectory().

Testing

npm run test:unit35 passed. Coverage: result.ts 100%, utils.ts ~91%.

Follow-ups (separate stories)

  • Group B — integration tests (concurrency, error/edge matrix) covering index.ts.
  • Group C — TCK harness + skip mechanism for the tck lane.

🤖 Generated with Claude Code

…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>
@mlischetti
mlischetti requested a review from a team as a code owner July 20, 2026 15:11
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>

@gsfernandes gsfernandes 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.

LGTM

@mlischetti
mlischetti merged commit 144d9db into master Jul 20, 2026
3 checks passed
@mlischetti
mlischetti deleted the W-23513166-node-unit-testing branch July 20, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants