Skip to content
Permalink
Browse files

Make scripts crash on unhandled rejections (facebook#1819)

* Makes end-to-end testing crash on unhandled rejections

* Comment fix
  • Loading branch information...
dbismut authored and Timer committed Mar 14, 2017
1 parent a34d48a commit 42ebfc9f198ab02295276b0ebb12e40a488b2a73
Showing with 35 additions and 0 deletions.
  1. +7 −0 scripts/build.js
  2. +7 −0 scripts/eject.js
  3. +7 −0 scripts/init.js
  4. +7 −0 scripts/start.js
  5. +7 −0 scripts/test.js
@@ -13,6 +13,13 @@
// Do this as the first thing so that any code reading it knows the right env.
process.env.NODE_ENV = 'production';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

// Load environment variables from .env file. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set.
@@ -9,6 +9,13 @@
*/
'use strict';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

const fs = require('fs-extra');
const path = require('path');
const spawnSync = require('cross-spawn').sync;
@@ -9,6 +9,13 @@
*/
'use strict';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

const fs = require('fs-extra');
const path = require('path');
const spawn = require('cross-spawn');
@@ -10,6 +10,13 @@
// @remove-on-eject-end
'use strict';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

process.env.NODE_ENV = 'development';

// Load environment variables from .env file. Suppress warnings using silent
@@ -13,6 +13,13 @@
process.env.NODE_ENV = 'test';
process.env.PUBLIC_URL = '';

// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on('unhandledRejection', err => {
throw err;
});

// Load environment variables from .env file. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables
// that have already been set.

0 comments on commit 42ebfc9

Please sign in to comment.
You can’t perform that action at this time.