diff --git a/package.json b/package.json index 981d80f1c..4aaa26e5e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,10 @@ "jest": { "transform": { "\\.(js)$": "/static/transforms/index.js" - } + }, + "setupFiles": [ + "/static/globalTestSetup.js" + ] }, "devDependencies": { "@jest-runner/electron": "^0.1.0", diff --git a/static/globalTestSetup.js b/static/globalTestSetup.js new file mode 100644 index 000000000..ae8a72c84 --- /dev/null +++ b/static/globalTestSetup.js @@ -0,0 +1,14 @@ +/** + * Copyright 2018-present Facebook. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * @format + */ +const defaultConsoleError = console.error; + +console.error = function(message) { + defaultConsoleError( + 'console.error used in a test. This will be an error in the near future.', + ); + defaultConsoleError.apply(console, arguments); +};