Add N-API compliance tests #116
Open
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.
Pulled from @vmoroz 's awesome hermes-windows work that is being upstreamed into Hermes, this pull request runs his now-portable test suite here in JsRuntimeHost. It actually found one bug so far!
The bug was JSC-specific: our JavaScriptCore wrapper previously passed nullptr to JSObjectCallAsFunction when the receiver was undefined, so the VM forcibly substituted the global object even in strict mode. The new implementation always routes through Function.prototype.call, preserving the exact thisArg.
New tests run on macOS and Android simulator. We can add it into the Azure pipelines in a separate PR, unless you all would prefer otherwise.
Note:
Right now, there is no good way to package up the test suite, this is something Vlad, myself, and other collaborators have been discussing with the broader NodeJS community. Feels a little gross to duplicate the files, but we're giving another consumer use case that the packaging choices can be cross-checked against. yay community!
We now have a safety net make bumping NAPI_VERSION to 6 (and beyond) to drive parity and congruence with hermes-windows (and React Native [Windows] itself). Our (rbckr.co) app will need these expanded NAPI capabilities so that we can run the code currently running in web workers in our BabylonJS WebXR app in separate JS domains/worklets that communicate with the main BabylonJS thread.