massive-oss / mcover

A cross platform code coverage framework for Haxe with testing and profiling applications. Supports AVM1, AVM2, JavaScript, C++, PHP and Neko.
Other
59 stars 9 forks source link

How to ignore compilation of some files inside a classpath. #27

Open saana1 opened 10 years ago

saana1 commented 10 years ago

My haxe code has multiple files within a single class path folder."myexample/hxproj/common/src".

Since MCOVER expects classPath and NOT individual file names, how do I exclude some of the files from being compiled ?I cannot move out any file..have to just ignore some files in that classPath. In the normal build I can use a MAKEFILE to add list of files I compile in the folder. I do not want MCover to compile few files which are not in the MAKEFILE.

Please note that ignoreClass option in the MCOVER macro will not help here as it appears to still compile these classes and only ignore it when reporting the coverage.

misprintt commented 10 years ago

Hi,

The MCover macro loops through all files in all packages and runs a regex against each class to filter out any classes with @:IgnoreCover metadata. The ignoreClasses macro effectively does the same thing.

These classes are not added to the compiler by MCover.

If another class (that is included in compilation) references this class then the compiler will still compile it (normal compiler behaviour). In this case you may need to wrap the 'ignored' class around conditional compilation flags to prevent it from being compiled under specific conditions.

This can often occur when compiling for multiple targets and having some classes are target specific (e.g. SomeClass_js.hx and SomeClass_flash.hx).

saana1 commented 10 years ago

Hi

My mcover macro is like this: mcover.MCover.coverage([''],['ex/app1/src'],['app1.src.AppTest','app1.src.FlyoutTest'])

I want to ignore the classess FlyoutTest and AppTest and hence I added them in the IgnoreClass macro list. But during build, it compiles the classes AppTest and FlyoutTest. There is compile error in AppTest class. ( this is a known error and I had planned to fix it up later, so wanted mcover to skip this class!) I tried adding the @:IgnoreCover metadata on top of AppTest class. But still it is getting comipled.

Anyways, when I run the report, the details for FlyoutTest and AppTest are not present. But I want to skip the comiplation also.

Thanks.