From c5192a4e855478cd1718b96d9a48eaf9d2f4cd9d Mon Sep 17 00:00:00 2001 From: balazsmatepetro Date: Thu, 17 Feb 2022 09:32:09 +0100 Subject: [PATCH] fix(codemod): do not log warnings in the test environment Warning the user about the unprocessable query keys is useful in production, but in the test environment, it just makes it more difficult to read the output. --- codemods/v4/utils/replacers/key-replacer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codemods/v4/utils/replacers/key-replacer.js b/codemods/v4/utils/replacers/key-replacer.js index 59c1bca092..621902edb5 100644 --- a/codemods/v4/utils/replacers/key-replacer.js +++ b/codemods/v4/utils/replacers/key-replacer.js @@ -147,7 +147,10 @@ module.exports = ({ jscodeshift, root, filePath, keyName = 'queryKey' }) => { ) } catch (error) { if (error.name === 'UnprocessableKeyError') { - console.warn(error.message) + if (process.env.NODE_ENV !== 'test') { + console.warn(error.message) + } + return node }