Jump to content

Test Coverage for PIXI.JS


brean
 Share

Recommended Posts

Hi,

 

There is currently no test coverage for PIXI.JS.

Are there any ideas how coverage of pixi.js could be generated?

 

I have a very similar setup for my project ( pixi_ui - it is using everything that PIXI uses: gulp, testem, mocha+chai) and I think I will keep following PIXI (well... as long as it makes sense).

But I have not found an easy solution that generates a coverage report for mocha+chai tests.

Link to comment
Share on other sites

Hi xerver,

 

thank you for your answer, I already took a small look at istanbul and blanket.js (and jscoverage) but how do I get them running with testem?

 

There is a testem-istanbul example here:

https://github.com/airportyh/testem/tree/master/examples/coverage_istanbul

but running an own server for tests seems wrong (I think that is the only solution for now, I will try it later if I do not get something else running).

 

Accoring to the blanket documentation I just need to reference the blanket.js-file in the HTML for my test runner and add the data-cover attribute for all embedded js-files I want to test, but there is no HTML file for the tests in PIXI, so how do I create this?!

 

For jscoverage (and other tools) I tired modifying the "launchers"->"node"->"command". But then the ./test/setup.js gets ignored and testem does not find chai anymore.

 

So it all sounds easy but especially for the combination of tools in this setup (gulp, testem, browserify and chai) I can not find a way to get the coverage.

Link to comment
Share on other sites

Hi xaver,

 

thank you for your help, but I still can not get any coverage.

 

Istanbul:

I tried the istanbul-coverage server solution, but that only generates an empty report.

 

Blanket:

Adding the required "data-cover" for the files I want to test is not possible for a generated index file, or can I specify the files somewhere else?

 

Everything else:

I still have the problem that I can not run the tests from command line calling mocha directly. The command in the testem.json "launchers"->"node"->"command" does not work because it does not find chai.

Link to comment
Share on other sites

Running this in the pixi.js-folder:

./node_modules/.bin/mocha -r chai bin/pixi.js test/setup.js test/unit/**/*.test.js -R tap --recursive ./test/unit

finds chai, but it fails because without a browser document is not defined.

Link to comment
Share on other sites

Using karma I was able to run my tests in a browser and generated a text-based coverage (the html output jasmine in combination with browserify does not work).

My karma config can be found here:

https://github.com/brean/pixi_ui/blob/master/test/karma.conf.js

(based on https://github.com/karma-runner/karma-coverage/issues/16 )

 

Because I want cool HTML-coverage I will dive into blanket next.

Link to comment
Share on other sites


 

I run browserify manually and load the file in the browser. I only get coverage for the combined .js file. But I can work with this, it is better than to the karma-jasmine solution because now I see which lines exactly are not covered by tests (instead of just numbers in the jasmine-solution).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...