vendredi 25 septembre 2015

Coverage Reporting for Karma using SystemJS

I am attempting to get code coverage working on this project: http://ift.tt/1QE325z

Everything is confined to the ./src/client/test/ directory for now. (for simplicity)

In other words:

I run the command npm run test,

test.ts and test.spec.ts get compiled to es5 and added to the tmp/serve/test directory.

The unit tests are run with karma and call the main method on the unit test through the test_main.js file loaded at the end of karma.cfg.js, which has systemjs load the specs internally. This is very simmilar to what the angular2 team is doing for their unit tests.

When I uncomment this line: http://ift.tt/1NZCYUO

I get this error:

PhantomJS 1.9.8 (Mac OS X 0.0.0) test function should pass FAILED
    TypeError: 'undefined' is not a function (evaluating 'test_1.testFunction()') at http://localhost:9876/context.html:7
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.005 secs / 0 secs)

Otherwise everything seems to be working correctly.

The only thing I can think of is I need an instrumentor for typescript, like isparta for babel, and as of now none exist that I know of.

Any advise is much appreciated.

Aucun commentaire:

Enregistrer un commentaire