@samitouri / QOS-React / commits / 7204b636ee

Run tests for Fire feature flags (#13628)

* Run tests for Fire feature flags * Only run ReactDOM tests for Fire

Dan Abramov committed Sep 12, 2018 at 16:17 UTC 7204b636ee2b46608811b11111a6cb4e544a8276
4 files changed +24
package.json
+2
@@ -99,7 +99,9 @@
99 "postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json && node ./scripts/flow/createFlowConfigs.js",
100 "debug-test": "cross-env NODE_ENV=development node --inspect-brk node_modules/.bin/jest --config ./scripts/jest/config.source.js --runInBand",
101 "test": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source.js",
102 + "test-fire": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.source-fire.js",
103 "test-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source.js",
104 + "test-fire-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.source-fire.js",
105 "test-prod-build": "yarn test-build-prod",
106 "test-build": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.build.js",
107 "test-build-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.build.js",
scripts/circleci/test_entry_point.sh
+3
@@ -19,6 +19,9 @@ fi
19
20 if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
21 COMMANDS_TO_RUN+=('yarn test-prod --maxWorkers=2')
22 + # React Fire:
23 + COMMANDS_TO_RUN+=('yarn test-fire --maxWorkers=2')
24 + COMMANDS_TO_RUN+=('yarn test-fire-prod --maxWorkers=2')
25 fi
26
27 if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
scripts/jest/config.source-fire.js new
+12
@@ -0,0 +1,12 @@
1 +'use strict';
2 +
3 +const baseConfig = require('./config.base');
4 +
5 +module.exports = Object.assign({}, baseConfig, {
6 + roots: ['<rootDir>/packages/react-dom'],
7 + setupFiles: [
8 + ...baseConfig.setupFiles,
9 + require.resolve('./setupFire.js'),
10 + require.resolve('./setupHostConfigs.js'),
11 + ],
12 +});
scripts/jest/setupFire.js new
+7
@@ -0,0 +1,7 @@
1 +'use strict';
2 +
3 +jest.mock('shared/ReactFeatureFlags', () => {
4 + const ReactFeatureFlags = require.requireActual('shared/ReactFeatureFlags');
5 + // TODO: Set feature flags for Fire
6 + return ReactFeatureFlags;
7 +});