From 75d356f3e99f353ef2ca4ac5c8719f70a7df3a58 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Tue, 23 Jul 2019 22:51:39 +0200 Subject: [PATCH] chore: supress error messages regarding error boundary in tests (#28) --- jest/setup.js | 9 +++++++++ package.json | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 jest/setup.js diff --git a/jest/setup.js b/jest/setup.js new file mode 100644 index 00000000..66d583af --- /dev/null +++ b/jest/setup.js @@ -0,0 +1,9 @@ +const error = console.error; + +console.error = (...args) => + // Supress error messages regarding error boundary in tests + /Consider adding an error boundary to your tree to customize error handling behavior/m.test( + args[0] + ) + ? void 0 + : error(...args); diff --git a/package.json b/package.json index 8dd85e8d..9cca52c6 100644 --- a/package.json +++ b/package.json @@ -80,6 +80,7 @@ "testRegex": "/__tests__/.*\\.(test|spec)\\.(js|tsx?)$", "transform": { "^.+\\.(js|ts|tsx)$": "babel-jest" - } + }, + "setupFiles": ["/jest/setup.js"] } }