mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
+2
-1
@@ -1,7 +1,7 @@
|
||||
---
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
- 4
|
||||
sudo: false
|
||||
cache:
|
||||
directories:
|
||||
@@ -16,6 +16,7 @@ before_install:
|
||||
exit
|
||||
fi
|
||||
npm install -g npm@latest-2
|
||||
npm --version
|
||||
script:
|
||||
- |
|
||||
if [ "$TEST_TYPE" = build_website ]; then
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@
|
||||
"gulp-flatten": "^0.1.0",
|
||||
"gulp-util": "^3.0.5",
|
||||
"gzip-js": "~0.3.2",
|
||||
"jest-cli": "^0.4.13",
|
||||
"jest-cli": "^0.5.7",
|
||||
"jstransform": "^11.0.0",
|
||||
"object-assign": "^3.0.0",
|
||||
"optimist": "^0.6.1",
|
||||
@@ -40,7 +40,7 @@
|
||||
"uglifyify": "^3.0.1"
|
||||
},
|
||||
"devEngines": {
|
||||
"node": "0.10.x",
|
||||
"node": "4.x",
|
||||
"npm": "2.x"
|
||||
},
|
||||
"commonerConfig": {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/* eslint-disable */
|
||||
__DEV__ = true;
|
||||
global.__DEV__ = true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var assign = require('object-assign');
|
||||
var babel = require('babel');
|
||||
var coffee = require('coffee-script');
|
||||
|
||||
@@ -12,6 +13,28 @@ var tsPreprocessor = require('./ts-preprocessor');
|
||||
var moduleMap = require('fbjs/module-map');
|
||||
var babelPluginDEV = require('fbjs-scripts/babel/dev-expression');
|
||||
var babelPluginModules = require('fbjs-scripts/babel/rewrite-modules');
|
||||
var createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
||||
|
||||
// Use require.resolve to be resiliant to file moves, npm updates, etc
|
||||
var pathToBabel = path.join(require.resolve('babel'), '..', 'package.json');
|
||||
var pathToModuleMap = require.resolve('fbjs/module-map');
|
||||
var pathToBabelPluginDev = require.resolve('fbjs-scripts/babel/dev-expression');
|
||||
var pathToBabelPluginModules = require.resolve('fbjs-scripts/babel/rewrite-modules');
|
||||
|
||||
// TODO: make sure this stays in sync with gulpfile
|
||||
var babelOptions = {
|
||||
nonStandard: true,
|
||||
blacklist: [
|
||||
'spec.functionName',
|
||||
'validation.react',
|
||||
],
|
||||
optional: [
|
||||
'es7.trailingFunctionCommas',
|
||||
],
|
||||
plugins: [babelPluginDEV, babelPluginModules],
|
||||
retainLines: true,
|
||||
_moduleMap: moduleMap,
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
process: function(src, filePath) {
|
||||
@@ -21,24 +44,12 @@ module.exports = {
|
||||
if (filePath.match(/\.ts$/) && !filePath.match(/\.d\.ts$/)) {
|
||||
return tsPreprocessor.compile(src, filePath);
|
||||
}
|
||||
// TODO: make sure this stays in sync with gulpfile
|
||||
if (!filePath.match(/\/node_modules\//) &&
|
||||
!filePath.match(/\/third_party\//)) {
|
||||
var rv = babel.transform(src, {
|
||||
nonStandard: true,
|
||||
blacklist: [
|
||||
'spec.functionName',
|
||||
'validation.react',
|
||||
],
|
||||
optional: [
|
||||
'es7.trailingFunctionCommas',
|
||||
],
|
||||
plugins: [babelPluginDEV, babelPluginModules],
|
||||
filename: filePath,
|
||||
retainLines: true,
|
||||
_moduleMap: moduleMap,
|
||||
}).code;
|
||||
|
||||
if (
|
||||
!filePath.match(/\/node_modules\//) &&
|
||||
!filePath.match(/\/third_party\//)
|
||||
) {
|
||||
var rv =
|
||||
babel.transform(src, assign({filename: filePath}, babelOptions)).code;
|
||||
// hax to turn fbjs/lib/foo into /path/to/node_modules/fbjs/lib/foo
|
||||
// because jest is slooow with node_modules paths (facebook/jest#465)
|
||||
rv = rv.replace(
|
||||
@@ -58,4 +69,12 @@ module.exports = {
|
||||
}
|
||||
return src;
|
||||
},
|
||||
|
||||
getCacheKey: createCacheKeyFunction([
|
||||
__filename,
|
||||
pathToBabel,
|
||||
pathToModuleMap,
|
||||
pathToBabelPluginDev,
|
||||
pathToBabelPluginModules,
|
||||
]),
|
||||
};
|
||||
|
||||
@@ -12,19 +12,12 @@
|
||||
'use strict';
|
||||
|
||||
function getTestDocument(markup) {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.style.display = 'none';
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
var testDocument = iframe.contentDocument || iframe.contentWindow.document;
|
||||
testDocument.open();
|
||||
testDocument.write(
|
||||
document.open();
|
||||
document.write(
|
||||
markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>'
|
||||
);
|
||||
testDocument.close();
|
||||
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
return testDocument;
|
||||
document.close();
|
||||
return document;
|
||||
}
|
||||
|
||||
module.exports = getTestDocument;
|
||||
|
||||
Reference in New Issue
Block a user