Accessing js namespace when using Haxe Test Explorer for Visual Studio Code

I am trying the new Haxe Test Explorer for VSC and so far it looks pretty cool! Being able to quickly iterate on tests inside the editing environment makes Test Driven Development so much closer. Very good job guys :smiley:

What I am experiencing though is that you cannot access the js namespace as the tests are running in eval. On the documentation page it says: “Currently only works for Node.js and sys targets”. How can one use this Node.js target as I assume this would allow me to use the js namespace, right?

The tests don’t run in eval, they run on whatever platform you’re targeting.

Node.js target just means using the hxnodejs Haxelib (-lib hxnodejs) and running the application with node.

When running tests through test explorer, it literally calls haxe test.hxml -lib test-adapter (unless you changed it via haxeTestExplorer.testCommand setting).
If test.hxml builds a Node.js target (or any other target), you have to make sure that someone actually runs node with your output file (or executes your C++ binary or .jar file, etc.). So you will have to add some -cmd node test.js call to your test.hxml, to make it run your tests directly after compiling.