Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Coverage #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

DNoved1
Copy link
Contributor

@DNoved1 DNoved1 commented Mar 8, 2016

Using Istanbul and Remap-Istanbul.

The basic code flow is:

  • The tests page now instruments all of argon's code with istanbul.
  • Tests are run, as before. This also records coverage information because of the instrumentation.
  • The tests page reports the coverage information along with the transpiled js (from ts), and sourcemaps representing that transpilation down to the node server using socket.io (included with browser-sync).
  • The node server uses remap-istanbul to apply the sourcemaps to the transpiled js in order to get coverage data for the original typescript.
  • The typescript coverage information is turned into a html report at coverage/index.html using istanbul.

@DNoved1
Copy link
Contributor Author

DNoved1 commented Mar 8, 2016

If there's a way to reduce the amount of chnages to the jspm.config.js file, I'd love to know. Simply adding istanbul, escodegen, and esprima seems to have pulled in about 400 lines of configuration information for their dependencies.

@speigg
Copy link
Contributor

speigg commented Mar 10, 2016

The only way to reduce the amount of dependencies that are pulled in is to add an override in package.json which maps everything you don't need to @empty. I don't think we need any of the nodejs related dependencies since all of our test code runs in the browser. See if you can fix that.

Also, can we have the coverage results output somewhere other than in the src folder?

@DNoved1
Copy link
Contributor Author

DNoved1 commented Mar 10, 2016

The coverage should be output to the coverage folder, is it being put in the src folder when you run it?

DNoved1 added 2 commits April 26, 2016 02:53
A few problems need to still be solved:
  * Automatically writing the coverage data to a file. As mentioned in
    one of the comments in test/index.html, this can be done with the
    browser file api which is only supported by chrome at the moment, or
    perhaps by using web sockets to send the data back to the server
    which can then write the file to disk.
  * Source maps - currently istanbul's code coverage is based on the
    transpiled typescript, and so does not accurately reflect the
    original code. It's possible to connect the two mentally, but
    difficult. The remap-istanbul project may be of use here.
  * The method of injecting istanbul into the SystemJS module loader is
    a bit of a hack; we can probably make it a cleaner hack by writing a
    SystemJS plugin which we use specifically for loading our files
    during testing.
Aka the previous coverage reports over the transpiled js (from ts) now
have sourcemaps applied to them so that the coverage reports are now
over ts.

Also made coverage reports be automatically written as the tests are
run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants