mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-22 20:39:05 +08:00
Make scripts crash on unhandled rejections (#1819)
* Makes end-to-end testing crash on unhandled rejections * Comment fix
This commit is contained in:
7
packages/react-scripts/scripts/build.js
vendored
7
packages/react-scripts/scripts/build.js
vendored
@@ -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.
|
||||
|
||||
7
packages/react-scripts/scripts/eject.js
vendored
7
packages/react-scripts/scripts/eject.js
vendored
@@ -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;
|
||||
|
||||
7
packages/react-scripts/scripts/init.js
vendored
7
packages/react-scripts/scripts/init.js
vendored
@@ -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');
|
||||
|
||||
7
packages/react-scripts/scripts/start.js
vendored
7
packages/react-scripts/scripts/start.js
vendored
@@ -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
|
||||
|
||||
7
packages/react-scripts/scripts/test.js
vendored
7
packages/react-scripts/scripts/test.js
vendored
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user