Provides an example of instrumenting JSPM / SystemJS for code coverage with Istanbul / Mocha.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test/src
.babelrc
.esdocrc
.eslintignore
.eslintrc
.gitignore
.npmscriptrc
.travis.yml
AUTHORS.md
LICENSE
README.md
config.js
package.json

README.md

istanbul-jspm-coverage-example

Code Style License Gitter

Build Status Coverage Dependency Status

At one point in time Istanbul didn't have a hook for coverage of tests using JSPM / SystemJS.

Please refer to the following issues:

A solution is now available that replaces the System.translate function with one that instruments code coverage that is easily setup from standard testing environments including Mocha.

In particular please review the following NPM modules:

typhonjs-istanbul-instrument-jspm provides the instrumentation hook.

typhonjs-npm-build-test provides an all inclusive NPM module with dependencies for building / testing / publishing NPM modules and instrumenting JSPM / SystemJS tests.

Please note that Node 5+ / NPM 3+ may be required due to flat package installation introduced in NPM v3.

To setup:

  • npm install -g jspm (if not already installed globally)
  • npm install
  • jspm install

To run tests with coverage for SystemJS:

  • npm run test-coverage

A coverage report is then available in ./coverage and contains the source code in ./src loaded by SystemJS in ./test/src/TestJSPM.js

Coverage on pushes is generated by Travis CI and uploaded to Codecov. Click the "coverage" icon at the top to see the SystemJS loaded code that is automatically hosted on Codecov. If you happen to have the Chrome, Firefox or Opera Codecov plugin installed when you view the source on GitHub the latest coverage report is overlayed on top.

Test scripts are defined in package.json

The hook implementation can be viewed here: instrumentIstanbulSystem.js

As a bonus examples of using ESLint and ESDoc which is included in typhonjs-npm-build-test are also available as NPM scripts.