1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 19:58:11 +01:00
metamask-extension/development/lib/exit-with-error.js
Mark Stacey 7535d63466
Add run-e2e-test.js script (#11301)
This script makes it easier to run an individual E2E test. In the past
I've run individual scripts by editing `run-all.sh` manually, but now
that can be done more easily with this script. It also allows setting
the number of retries to use and the browser to use from the CLI.

This script has been added as an npm script as well, called
'test:e2e:single'.

The `run-all.sh` script was rewritten in JavaScript to make it easier
to pass through a `--retries` argument.

The default number of retries has been set to zero to make local
testing easier. It has been set to 2 on CI.

This was mainly done to consolidate the code used to run an E2E test in
one place, to make later improvements easier.
2021-06-15 15:21:25 -02:30

17 lines
494 B
JavaScript

/**
* Exit the process with an error message.
*
* Note that this should be called before the process ends, but it will not
* itself end the process. This is because the Node.js documentation strongly
* advises against calling `process.exit` directly.
*
* @param {string} errorMessage - The error message that is causing the non-
* zero exit code.
*/
function exitWithError(errorMessage) {
console.error(errorMessage);
process.exitCode = 1;
}
module.exports = { exitWithError };