Best way to use munit with OpenFL

If you are using (are interested in) munit with OpenFL, I just found the best way to trick it into letting OpenFL build the project:

https://github.com/openfl/openfl/blob/master/tests/test.hxml

I tell it where to find the SWF and JS files (for runtime), but don’t output and instead allow -cmd to do the building :success:

3 Likes

I’m pretty curious how this works underneath. I see that openfl/RunScript.hx just passes along parameters at the end (“build” not mentioned anywhere before that) to haxelib. But haxelib doesn’t have a “build” parameter either. So where does “build” actually mean something?

(I’m trying to figure this out so I can use the above code to get munit to test my own library, which uses HaxeFlixel, hopefully with html5.)

the trick is to set 1.) the same output as OpenFL, use 2.) --no-output so that it does try to compile and 3.) -cmd so it runs our real OpenFL command to build

OK, thanks–I’m not sure I understand what you mean. But meanwhile I managed to get things working anyway! I will post a write-up when I’m done–it’s a bit different than the straight OpenFL method when using HaxeFlixel (at least it seems so…I didn’t need a -cmd openfl anything.)

The writeup is here if anyone is interested.