-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Coverage reports now accurately reflect source
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.
- Loading branch information
DNoved1
authored and
DNoved1
committed
Apr 26, 2016
1 parent
5843f39
commit d61d48d
Showing
4 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env node | ||
|
||
var bs = require('browser-sync').create(); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var remap = require('remap-istanbul/lib/remap'); | ||
var writeReport = require('remap-istanbul/lib/writeReport'); | ||
|
||
bs.init({ | ||
server: { | ||
directory: true | ||
}, | ||
startPath: '../index.html', | ||
files: '../src/**' | ||
}, function() { | ||
bs.sockets.on('connection', function(client) { | ||
client.on('argon:coverage', function(data) { | ||
var coverage = data.coverage; | ||
var sourceMaps = data.sourceMaps; | ||
var sourceJs = data.sourceJs; | ||
|
||
var collector = remap(coverage, { | ||
readFile: function(fileName) { | ||
if (sourceJs[fileName]) { | ||
return new Buffer(sourceJs[fileName]); | ||
} else { | ||
throw new Error('No such js file "' + fileName + '".'); | ||
} | ||
}, | ||
readJSON: function(fileName) { | ||
if (sourceMaps[fileName]) { | ||
return sourceMaps[fileName]; | ||
} else { | ||
throw new Error('No such source map "' + fileName + '".'); | ||
} | ||
} | ||
}); | ||
|
||
writeReport(collector, 'html', path.join(__dirname, '../coverage')).then(function() { | ||
console.log('Wrote new coverage report to "' + path.join(__dirname, '../coverage/index.html') + '".'); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters