mirror of
https://github.com/facebook/react.git
synced 2026-02-23 20:23:02 +00:00
Run fiber tests just once on Travis (#8221)
Consolidate facts tracking with the other script.
This commit is contained in:
17
.travis.yml
17
.travis.yml
@@ -81,22 +81,7 @@ script:
|
||||
git checkout -- src/renderers/dom/shared/ReactDOMFeatureFlags.js
|
||||
|
||||
echo 'Testing in fiber mode...'
|
||||
printf '\nmodule.exports.useFiber = true;\n' \
|
||||
>> src/renderers/dom/shared/ReactDOMFeatureFlags.js
|
||||
FIBER_TESTS=`\
|
||||
NODE_ENV=test node node_modules/jest/bin/jest --json | \
|
||||
node -e "\
|
||||
var data = JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8')); \
|
||||
console.log(data.numPassedTests + '/' + data.numTotalTests)\
|
||||
"\
|
||||
`
|
||||
git checkout -- src/renderers/dom/shared/ReactDOMFeatureFlags.js
|
||||
node scripts/facts-tracker/index.js \
|
||||
"fiber-tests" "$FIBER_TESTS"
|
||||
|
||||
# Should consolidate this with the above fiber run
|
||||
echo 'Testing in fiber mode against test records...'
|
||||
scripts/fiber/record-tests
|
||||
scripts/fiber/record-tests --track-facts
|
||||
git --no-pager diff scripts/fiber
|
||||
FIBER_TESTS_STATUS=$(git status --porcelain scripts/fiber)
|
||||
test -z "$FIBER_TESTS_STATUS"
|
||||
|
||||
@@ -70,7 +70,8 @@
|
||||
"tmp": "~0.0.28",
|
||||
"typescript": "~1.8.10",
|
||||
"uglify-js": "^2.5.0",
|
||||
"uglifyify": "^3.0.1"
|
||||
"uglifyify": "^3.0.1",
|
||||
"yargs": "^6.3.0"
|
||||
},
|
||||
"devEngines": {
|
||||
"node": "4.x || 5.x || 6.x || 7.x",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const child_process = require('child_process');
|
||||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
@@ -84,7 +85,7 @@ function formatResults(runResults, predicate) {
|
||||
return formatted.join('\n\n');
|
||||
}
|
||||
|
||||
function recordTests() {
|
||||
function recordTests(trackFacts) {
|
||||
process.env.REACT_DOM_JEST_USE_FIBER = true;
|
||||
runJest()
|
||||
.then((runResults) => {
|
||||
@@ -104,11 +105,34 @@ function recordTests() {
|
||||
path.join(__dirname, 'tests-failing.txt'),
|
||||
failing + '\n'
|
||||
);
|
||||
|
||||
if (trackFacts) {
|
||||
const fact = runResults.numPassedTests + '/' + runResults.numTotalTests;
|
||||
// TODO: Shelling out here is silly.
|
||||
child_process.spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
path.join(__dirname, '../facts-tracker/index.js'),
|
||||
'fiber-tests',
|
||||
fact,
|
||||
],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
recordTests();
|
||||
const argv = require('yargs')
|
||||
.demand(0, 0)
|
||||
.boolean('track-facts')
|
||||
.describe('track-facts', 'Use facts-tracker to record passing tests.')
|
||||
.strict()
|
||||
.help()
|
||||
.argv;
|
||||
recordTests(argv.trackFacts);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
Reference in New Issue
Block a user