[remote-dbg-next] error running jest with localization
Categories
(DevTools :: about:debugging, task, P3)
Tracking
(Not tracked)
People
(Reporter: ogasidlo, Unassigned)
References
Details
(Whiteboard: remote-debugging-technical-debt )
Attachments
(1 obsolete file)
Follow up for 1520142
While running the Jest test and all tests pass, we get the following error message caused by Localization
:
console.error node_modules/prop-types/checkPropTypes.js:20
Warning: Failed context type: The l10n context field must be an instance of ReactLocalization.
in Localized
in button
in aside
in Message
STR:
- move to the Jest folder in
devtools/client/aboutdebugging-new/test/jest
- run
yarn install
- run
yarn test
This is caused by fluent-react
and we probably need shallow rendering provided by Enzyme here because:
Right now we use fluent with jest that creates a jest snapshot by grabbing the object and parsing it to the snapshot in JSON. As we do not render anything, the Localization id is not being replaced.
Mocking fluent inside the test seems like big overhead.
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Updated•5 years ago
|
Reporter | ||
Comment 1•5 years ago
|
||
After talking to Staś, using the shallow render method is what we want.
So using Enzyme with Jest is the right way to go.
We also just want to test the Localization IDs (not the strings) as Fluent is taking care of the rest.
Reporter | ||
Comment 2•5 years ago
|
||
Closing as information was provided.
If you'd like to take a look at the fixing patch, please check 1548465
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Comment 3•5 years ago
|
||
Comment 4•5 years ago
|
||
Comment on attachment 9068710 [details]
Bug 1546341 - Fix jest tests with localization, r=ladybenko!,jdescottes!
Revision D33160 was moved to bug 1548465. Setting attachment 9068710 [details] to obsolete.
Description
•