Skip to content

Commit

Permalink
fix(codemod): do not log warnings in the test environment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
balazsmatepetro committed Feb 17, 2022
1 parent 1988134 commit c5192a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion codemods/v4/utils/replacers/key-replacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit c5192a4

Please sign in to comment.