Ok, I think I managed it a bit further. I imported the lib in IntelliJ and also referred to the following modules which it seems to need (most of which I had to manually install): mlib, asynctools.
I’m targeting Flash, and it does produce a SWF file, but when I try to open it it fails with “call to external interface failed”.
I also tried setting JS as a target for this project. It produces a JS file but upon including it in an index and serving that file, it complains that MissingElementException: haxe.trace element not found at massive.munit.client.ExternalPrintClientJS#new(275)
Hello, unfortunately hamcrest is unmaintained and hasn’t been adapted to Haxe 4.
munit and mlib were very recently released with Haxe 4 support.
Output of the test.hxml compilation can’t be just executed - it has to be run by munit. The tool sets up a server and runs each platform in way allowing all the results to be aggregated.
Errors indicate that somehow the /src classpath is considered as the compilation root. Is by any chance /src the root of your code otherwise? You may have more success moving your tests under /test to be in a different folder than your sources.
Hey Philippe and thanks for answering . I just recently realized you are involved in some of the massive work Massive has been doing with Haxe . The more (not necessarily financial) wealth can be generated using Haxe, the better we’ll all be. I’m working on contributing to that wealth .
I have reconfigured munit using the haxelib run munit config -reset command and now the test folder is a sibling of src. I still get the hamcrest error when I run haxelib run munit test. I’ve been following this tutorial:
I still get the same hamcrest errors. I’ve tried to identify how hamcrest is used. I saw that in TestRunner.hx there is a compilation directive related to it. Is there a compilation flag that I can use to avoid using hamcrest? Since you mentioned munit and mlib were updated for Haxe 4, I assume we can unit test with munit on Haxe 4
Thank you @ablum! . This got me a bit further. I was now able to run the tests, however, neko.exe seems to have a problem. It hands, hogging 1 CPU core for 100% for a while, after which the command line crashes. I see no test results in my browser, obviously.
Massive Unit - Copyright 2019 Massive Interactive. Version src
haxe -main TestMain -lib munit -lib hamcrest -cp src -cp src/test -js build/js_test.js
haxe -main TestMain -lib munit -lib hamcrest -lib hxnodejs -cp src -cp src/test -js build/js_test.js
MUnit Results
------------------------------
Class: ExampleTest ..
==============================
PASSED
Tests: 2 Passed: 2 Failed: 0 Errors: 0 Ignored: 0 Time: 0.208
Tests PASSED under js using summary client
------------------------------
PLATFORMS TESTED: 1, PASSED: 1, FAILED: 0, ERRORS: 0, TIME: 30.76
------------------------------
ERROR: Local results server appeared to hang so test reporting was cancelled.
I tried the JS target too, after installing hxnodejs. Same thing happened.