mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
We disabled coverage in Travis because the implementation was crashing ( https://github.com/facebook/react/issues/6290 ). Since we upgraded to Jest 15, the entire coverage implementation is brand new so we should give it another try.
51 lines
951 B
JavaScript
51 lines
951 B
JavaScript
'use strict';
|
|
|
|
var grunt = require('grunt');
|
|
var path = require('path');
|
|
|
|
function run(done, coverage) {
|
|
grunt.log.writeln('running jest');
|
|
|
|
var args = [
|
|
path.join('node_modules', 'jest', 'bin', 'jest'),
|
|
];
|
|
if (coverage) {
|
|
args.push('--coverage');
|
|
}
|
|
grunt.util.spawn({
|
|
cmd: 'node',
|
|
args: args,
|
|
opts: {
|
|
stdio: 'inherit',
|
|
env: Object.assign({}, process.env, {
|
|
NODE_ENV: 'test',
|
|
}),
|
|
},
|
|
}, function(spawnErr, result, code) {
|
|
if (spawnErr) {
|
|
grunt.log.error('jest failed');
|
|
grunt.log.error(spawnErr);
|
|
} else {
|
|
grunt.log.ok('jest passed');
|
|
}
|
|
grunt.log.writeln(result.stdout);
|
|
|
|
done(code === 0);
|
|
});
|
|
}
|
|
|
|
function runJestNormally() {
|
|
var done = this.async();
|
|
run(done);
|
|
}
|
|
|
|
function runJestWithCoverage() {
|
|
var done = this.async();
|
|
run(done, /* coverage */ true);
|
|
}
|
|
|
|
module.exports = {
|
|
normal: runJestNormally,
|
|
coverage: runJestWithCoverage,
|
|
};
|