asciidisco / grunt-qunit-istanbul

Run QUnit unit tests in a headless PhantomJS instance & generate some nice code coverage metrics using Istanbul.
MIT License
33 stars 21 forks source link

Add prefix url option for server served assets #34

Closed joakin closed 9 years ago

joakin commented 9 years ago

This adds a configuration property to be able to specify a prefix path for the resources when served from a web server.

The reason is we are trying to get coverage for mediawiki mobile frontend extension, and we need an extra option for the coverage instrumented files to get matched to the urls since our tests are served from a mediawiki server which prefixes the resources with a path (w/).

Example:

// File system: './javascripts/index.js'
// Webserver url: 'localhost:8080/assets/my-project/javascripts/index.js'

{
  baseUrl: '../', // Go up one level to `my-project`
  prefixUrl: 'assets/' // Prefix used before the file path on the web url
}

By adding this variable, we can specify that prefix and then the url and the fs path matches and the instrumented code gets used.