[react-packager] Fix jest tests

This commit is contained in:
Amjad Masad 2015-02-25 12:57:33 -08:00
parent 6687c84467
commit cf7d196c45
6 changed files with 15 additions and 17 deletions

5
jestSupport/env.js Normal file
View File

@ -0,0 +1,5 @@
'use strict';
global.setImmediate = global.setImmediate || function(fn) {
return setTimeout(fn, 0);
};

View File

@ -10,6 +10,10 @@ module.exports = {
transformSource: transformSource,
process: function(src, fileName) {
if (fileName.match(/node_modules/)) {
return src;
}
try {
return transformSource(src);
} catch(e) {

View File

@ -8,12 +8,15 @@
},
"jest": {
"scriptPreprocessor": "jestSupport/scriptPreprocess.js",
"setupEnvScriptFile": "jestSupport/env.js",
"testPathIgnorePatterns": [
"/node_modules/",
"/packager/"
"/node_modules/"
],
"testFileExtensions": [
"js"
],
"unmockedModulePathPatterns": [
"source-map"
]
},
"scripts": {

View File

@ -1,14 +0,0 @@
{
"name": "react-packager",
"version": "0.1.0",
"description": "",
"main": "index.js",
"jest": {
"unmockedModulePathPatterns": [
"source-map"
],
"testPathIgnorePatterns": [
"JSAppServer/node_modules"
]
}
}

View File

@ -1,7 +1,7 @@
'use strict';
var path = require('path');
var version = require('../../package.json').version;
var version = require('../../../../package.json').version;
var tmpdir = require('os').tmpDir();
var pathUtils = require('../fb-path-utils');
var declareOpts = require('../lib/declareOpts');