Use babel-jest to preprocess test files

This commit is contained in:
Jeffrey Morgan 2015-06-04 19:15:22 -07:00
Родитель 4d82006b57
Коммит 44412ad26a
3 изменённых файлов: 10 добавлений и 23 удалений

Просмотреть файл

@ -1,5 +1,5 @@
{
"scriptPreprocessor": "<rootDir>/util/preprocessor.js",
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"setupEnvScriptFile": "<rootDir>/util/testenv.js",
"setupTestFrameworkScriptFile": "<rootDir>/util/prepare.js",
"unmockedModulePathPatterns": [
@ -9,10 +9,10 @@
"net",
"crypto",
"babel",
"<rootDir>/node_modules/.*JSONStream",
"<rootDir>/node_modules/object-assign",
"<rootDir>/node_modules/underscore",
"<rootDir>/node_modules/bluebird",
"<rootDir>/node_modules/source-map-support"
"bluebird",
"object-assign",
"underscore",
"source-map-support",
"<rootDir>/node_modules/.*JSONStream"
]
}

Просмотреть файл

@ -26,9 +26,9 @@
}
],
"docker-version": "1.6.2",
"docker-machine-version": "0.2.0",
"docker-machine-version": "0.3.0-rc1",
"docker-compose-version": "1.2.0",
"electron-version": "0.26.0",
"electron-version": "0.27.2",
"virtualbox-version": "4.3.28",
"virtualbox-filename": "VirtualBox-4.3.28.pkg",
"virtualbox-filename-win": "VirtualBox-4.3.28.exe",
@ -57,7 +57,7 @@
"react": "^0.13.1",
"react-bootstrap": "^0.20.3",
"react-retina-image": "^1.1.2",
"react-router": "^0.13.2",
"react-router": "^0.13.3",
"request": "^2.55.0",
"request-progress": "^0.3.1",
"rimraf": "^2.3.2",
@ -66,6 +66,7 @@
},
"devDependencies": {
"babel": "^5.1.10",
"babel-jest": "^5.2.0",
"gulp": "^3.8.11",
"gulp-babel": "^5.1.0",
"gulp-changed": "^1.2.1",

Просмотреть файл

@ -1,14 +0,0 @@
var babel = require('babel');
var fs = require('fs');
var crypto = require('crypto');
module.exports = {
process: function(src, filename) {
if (filename.indexOf('node_modules') !== -1) {
return src;
}
var compiled = babel.transform(src, {filename: filename, sourceMap: true});
fs.writeFileSync('/tmp/' + crypto.createHash('md5').update(filename).digest('hex') + '.map', JSON.stringify(compiled.map));
return compiled.code;
}
};