Open janehmueller opened 4 years ago
the npm script does not support the CLI argument --polyglot.
Thank you for the report. You are right, we should add the handling of this special option into our npm
script.
Adding it manually doesn’t fix the issue either though since the npm-cli is started in a new process and the flag is not passed to the new process (not quite sure how that works in the script).
Propagation of configuration options into child processes is a bit tricky. We use environment variables for this purpose. Your test-case will pass if you set NODE_POLYGLOT_OPTIONS
environment variable to --polyglot
. Of course, we should improve our handling of this option in node
launcher such that this environment variable is set for you when you pass --polyglot
option on the command line.
(internally tracked as GR-27607)
Hi there,
I’m trying to run a javascript test in a polyglot manner (using GraalVM CE 20.1.0 on MacOS) and have issues starting npm in a polyglot context (using mocha - shouldn’t matter though).
I've uploaded the code to reproduce the issue to https://github.com/janehmueller/graaljs-polyglot-test/
One note: the npm script does not support the CLI argument
--polyglot
. Adding it manually doesn’t fix the issue either though since the npm-cli is started in a new process and the flag is not passed to the new process (not quite sure how that works in the script).I get the following error when running my tests via
npm --jvm test
:The code in question
var add = Polyglot.eval("python", "2 + 3");
works fine in a polyglot node shell started vianode --jvm --polyglot
.