2

I've transitioned my project from NME to Openfl which runs beautifully, but when trying to run munit I receive the error...

"You cannot access the flash package while targeting cpp".

How do I get around this? Is this an hxcpp problem or Munit?

Tom
  • 1,610
  • 1
  • 15
  • 19

2 Answers2

1

I changed strategies, I now have the following setup as a work around.


project.nmml

test.nmml //project.nmml + test dependencies + two haxeflags...

<haxeflag name="-D testDebug" if="debug"/>
<haxeflag name="-D debug" if="debug"/>

test.hxml

-swf-version 10
-cmd openfl build test.nmml flash
-cmd mv build/flash/bin/TestMain.swf build/as3_test.swf
-swf build/as3_test.swf

testDebug.hxml

-swf-version 10
-cmd openfl build test.nmml flash -Ddebug
-cmd mv build/flash/bin/TestMain.swf build/as3_test.swf
-swf build/as3_test.swf

  • Run @TestDebug tests

    haxelib run munit test testDebug.hxml -as3

  • Run as3 tests

    haxelib run munit test test.hxml -as3

  • Run cpp tests

    haxelib run openfl test test.nmml cpp

Tom
  • 1,610
  • 1
  • 15
  • 19
0

I ran into this issue when building with the Haxe bundle in Sublime Text and was able to get around it by changing the method by which I built my project.

Now I hit shift-control-B and select my project xml file from the resulting popup, then select the target and build mode from the next popup.

If you're not building in Sublime Text, disregard this solution. But maybe it will help someone else searching the same error ;)