test: Revert rudimentary console filtering - #323
Merged
Conversation
While this successfully reduced noise, it introduced indirection when
valid console errors log in tests, making it far more difficult to
decipher where an error originates. This trade-off felt like a
net-negative.
Example indirection in error log, where the stack trace points to the
filter, rather than the error origin itself:
```
console.error
Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at /Users/davidcalhoun/Sites/a8c/studio/src/components/content-tab-assistant.tsx:76:3
at div
at div
at div
at ContentTabAssistant (/Users/davidcalhoun/Sites/a8c/studio/src/components/content-tab-assistant.tsx:172:40)
55 | }
56 |
> 57 | level( ...args );
| ^
58 | };
59 | }
60 | console.log = filteredConsole( console.log );
at console.error (jest-setup.ts:57:3)
at printWarning (node_modules/react/cjs/react-jsx-runtime.development.js:87:30)
at error (node_modules/react/cjs/react-jsx-runtime.development.js:61:7)
at validateExplicitKey (node_modules/react/cjs/react-jsx-runtime.development.js:1078:5)
at validateChildKeys (node_modules/react/cjs/react-jsx-runtime.development.js:1105:11)
at jsxWithValidation (node_modules/react/cjs/react-jsx-runtime.development.js:1266:15)
at jsxWithValidationStatic (node_modules/react/cjs/react-jsx-runtime.development.js:1296:12)
at src/components/content-tab-assistant.tsx:105:4
at renderWithHooks (node_modules/react-dom/cjs/react-dom.development.js:16305:18)
at updateFunctionComponent (node_modules/react-dom/cjs/react-dom.development.js:19588:20)
at updateSimpleMemoComponent (node_modules/react-dom/cjs/react-dom.development.js:19425:10)
at beginWork (node_modules/react-dom/cjs/react-dom.development.js:21678:16)
at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:27426:14)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:26560:12)
at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:26466:5)
at renderRootSync (node_modules/react-dom/cjs/react-dom.development.js:26434:7)
at performConcurrentWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:25738:74)
at flushActQueue (node_modules/react/cjs/react.development.js:2667:24)
at act (node_modules/react/cjs/react.development.js:2582:11)
at node_modules/@testing-library/react/dist/act-compat.js:46:25
at renderRoot (node_modules/@testing-library/react/dist/pure.js:161:26)
at render (node_modules/@testing-library/react/dist/pure.js:247:10)
at src/components/tests/content-tab-assistant.test.tsx:107:9
at src/components/tests/content-tab-assistant.test.tsx:8:71
at Object.<anonymous>.__awaiter (src/components/tests/content-tab-assistant.test.tsx:4:12)
at Object.<anonymous> (src/components/tests/content-tab-assistant.test.tsx:104:73)
```
fluiddot
approved these changes
Jul 1, 2024
fluiddot
left a comment
Contributor
There was a problem hiding this comment.
LGTM 🎊 !
I'd propose using the jest-console package to explicitly check for console logs, as well as to identify potential logs we introduce by mistake.
1 task
Member
Author
Agreed, the project would greatly benefit from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Relates to #316.
Proposed Changes
Revert rudimentary console filtering
While this successfully reduced noise, it introduced indirection when
valid console errors log in tests, making it far more difficult to
decipher where an error originates. This trade-off felt like a
net-negative.
Example indirection in error log, where the stack trace points to the
filter, rather than the error origin itself:
Example error indirection
Testing Instructions
N/A, no user-facing changes.
Pre-merge Checklist