Commit 0ace417c authored by David's avatar David Committed by Joe Haddad
Browse files

Make scripts crash on unhandled rejections (#1819)

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

* Comment fix
parent b3dc81df
4 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file,!1933Add note about installing watchman
Showing with 35 additions and 0 deletions
+35 -0
...@@ -13,6 +13,13 @@ ...@@ -13,6 +13,13 @@
// Do this as the first thing so that any code reading it knows the right env. // Do this as the first thing so that any code reading it knows the right env.
process.env.NODE_ENV = 'production'; 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 // Load environment variables from .env file. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables // if this file is missing. dotenv will never modify any environment variables
// that have already been set. // that have already been set.
......
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
*/ */
'use strict'; '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 fs = require('fs-extra');
const path = require('path'); const path = require('path');
const spawnSync = require('cross-spawn').sync; const spawnSync = require('cross-spawn').sync;
......
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
*/ */
'use strict'; '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 fs = require('fs-extra');
const path = require('path'); const path = require('path');
const spawn = require('cross-spawn'); const spawn = require('cross-spawn');
......
...@@ -10,6 +10,13 @@ ...@@ -10,6 +10,13 @@
// @remove-on-eject-end // @remove-on-eject-end
'use strict'; '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'; process.env.NODE_ENV = 'development';
// Load environment variables from .env file. Suppress warnings using silent // Load environment variables from .env file. Suppress warnings using silent
......
...@@ -13,6 +13,13 @@ ...@@ -13,6 +13,13 @@
process.env.NODE_ENV = 'test'; process.env.NODE_ENV = 'test';
process.env.PUBLIC_URL = ''; 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 // Load environment variables from .env file. Suppress warnings using silent
// if this file is missing. dotenv will never modify any environment variables // if this file is missing. dotenv will never modify any environment variables
// that have already been set. // that have already been set.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment