Skip to content

port test_function to CTS#48

Merged
kraenhansen merged 3 commits intonodejs:mainfrom
bavulapati:feat/port-test-function
Apr 25, 2026
Merged

port test_function to CTS#48
kraenhansen merged 3 commits intonodejs:mainfrom
bavulapati:feat/port-test-function

Conversation

@bavulapati
Copy link
Copy Markdown
Contributor

ports
test_function from the Node.js test suite to the CTS.

@bavulapati
Copy link
Copy Markdown
Contributor Author

@legendecas Fixed the lint issue. Can we run the tests again?

@bavulapati bavulapati force-pushed the feat/port-test-function branch from bbcdc8d to 8e803b4 Compare April 7, 2026 07:17
@kraenhansen
Copy link
Copy Markdown
Member

Verification: Test code compared against upstream Node.js

I compared the test files in this PR against the upstream Node.js source at test/js-native-api/test_function/.

C File: Identical

  • test_function.c — byte-for-byte identical to upstream

JS File: Mostly Expected Harness Adaptations

test.js has the standard mechanical changes, plus one behavioural difference:

  1. Quote style — single quotes → double quotes (prettier)
  2. Imports replaced with CTS globalsrequire('assert'), require('../../common'), etc. replaced with loadAddon(), and CTS globals (assert, mustCall)
  3. global.gc()gc() — uses CTS global directly
  4. Prettier formatting — trailing commas, multi-line reformatting

One non-mechanical change

  • func2: console.log('hello world!') removed — the upstream function body contains a console.log call before return null;, which was removed in this port. This is a minor behavioural difference: the upstream test exercises calling a JS function that has a side-effect (console output) before returning, whereas the ported version only returns null. Unlikely to affect test correctness, but worth noting as a deviation from verbatim.

ports
[test_function](https://github.com/nodejs/node/tree/main/test/js-native-api/test_function)
from the Node.js test suite to the CTS.

Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
@kraenhansen kraenhansen force-pushed the feat/port-test-function branch from 99eea6e to 623ff35 Compare April 25, 2026 22:48
@kraenhansen kraenhansen merged commit 4188361 into nodejs:main Apr 25, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from Need Triage to Done in Node-API Team Project Apr 25, 2026
@bavulapati bavulapati deleted the feat/port-test-function branch April 26, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants