Skip to content

Provides an example of instrumenting JSPM / SystemJS for code coverage with Istanbul / Mocha.

License

Notifications You must be signed in to change notification settings

typhonjs-demos-test/istanbul-jspm-coverage-example

Repository files navigation

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.

About

Provides an example of instrumenting JSPM / SystemJS for code coverage with Istanbul / Mocha.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published