forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.js
More file actions
30 lines (26 loc) · 950 Bytes
/
jest.js
File metadata and controls
30 lines (26 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// We run our own grunt task instead of using grunt-jest so that we can have
// more control. Specifically we want to set NODE_ENV and make sure stdio is
// inherited. We also run with --harmony directly so that we don't have to
// respawn immediately. We should be able to reduce some of this complexity
// when jest 0.5 is run on top of iojs.
'use strict';
var grunt = require('grunt');
var path = require('path');
module.exports = function() {
var done = this.async();
grunt.log.writeln('running jest (this may take a while)');
grunt.util.spawn({
cmd: 'node',
args: ['--harmony', path.join('node_modules', 'jest-cli', 'bin', 'jest')],
opts: {stdio: 'inherit', env: {NODE_ENV: 'test'}},
}, function(err, result, code) {
if (err) {
grunt.log.error('jest failed');
grunt.log.error(err);
} else {
grunt.log.ok('jest passed');
}
grunt.log.writeln(result.stdout);
done(code === 0);
});
};