Unbreak jest tests (and travis e2e tests)

Reviewed By: mkonicek

Differential Revision: D2652002

fb-gh-sync-id: 8aab8da47dd737acc4ee9acddc484bd3bbdf1184
This commit is contained in:
David Aurelio 2015-11-14 03:23:46 -08:00 committed by facebook-github-bot-4
parent 39ec693866
commit 21bae9b294
5 changed files with 738 additions and 744 deletions

View File

@ -8,4 +8,5 @@
*/
'use strict';
require('../packager/react-packager/src/Resolver/polyfills/babelHelpers.js');
global.__DEV__ = true;

1422
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -94,6 +94,7 @@
"image-size": "^0.3.5",
"immutable": "^3.7.5",
"joi": "^6.6.1",
"json5": "^0.4.0",
"jstransform": "^11.0.3",
"module-deps": "^3.9.1",
"node-fetch": "^1.3.3",

View File

@ -6,6 +6,7 @@
"syntax-async-functions",
"syntax-class-properties",
"syntax-trailing-function-commas",
"transform-class-properties",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoping",
"transform-es2015-classes",
@ -17,7 +18,6 @@
"transform-es2015-shorthand-properties",
"transform-es2015-spread",
"transform-es2015-template-literals",
"transform-class-properties",
"transform-flow-strip-types",
"transform-object-assign",
"transform-object-rest-spread",

View File

@ -11,51 +11,33 @@
'use strict';
const babel = require('babel-core');
const fs = require('fs');
const inlineRequires = require('fbjs-scripts/babel-6/inline-requires');
const json5 = require('json5');
const path = require('path');
const babelRC =
json5.parse(
fs.readFileSync(
path.resolve(__dirname, 'react-packager', '.babelrc')));
function transform(src, filename, options) {
options = options || {};
const plugins = [];
const extraPlugins = ['external-helpers-2'];
const extraConfig = {
filename,
sourceFileName: filename,
};
const config = Object.assign({}, babelRC, extraConfig);
if (options.inlineRequires) {
plugins.push([inlineRequires]);
extraPlugins.push(inlineRequires);
}
config.plugins = extraPlugins.concat(config.plugins);
const result = babel.transform(src, {
retainLines: true,
compact: true,
comments: false,
filename,
plugins: plugins.concat([
// Keep in sync with packager/react-packager/.babelrc
'external-helpers-2',
'syntax-async-functions',
'syntax-class-properties',
'syntax-jsx',
'syntax-trailing-function-commas',
'transform-class-properties',
'transform-es2015-arrow-functions',
'transform-es2015-block-scoping',
'transform-es2015-classes',
'transform-es2015-computed-properties',
'transform-es2015-constants',
'transform-es2015-destructuring',
['transform-es2015-modules-commonjs', {strict: false, allowTopLevelThis: true}],
'transform-es2015-parameters',
'transform-es2015-shorthand-properties',
'transform-es2015-spread',
'transform-es2015-template-literals',
'transform-flow-strip-types',
'transform-object-assign',
'transform-object-rest-spread',
'transform-object-assign',
'transform-react-display-name',
'transform-react-jsx',
'transform-regenerator',
]),
sourceFileName: filename,
sourceMaps: false,
});
const result = babel.transform(src, Object.assign({}, babelRC, config));
return {
code: result.code