Closed sawyerh closed 9 months ago
That's a fair point, thanks for the hint!
Note that next-intl/server
can probably not be used in a meaningful way in unit tests with Jest currently, since it requires the RSC environment. However, in your case you're merely testing a page that happens to also have a metadata export and next-intl/server
isn't used in the tested code. I think we can make this work as long as you're not invoking any functions from next-intl/server
.
For other cases, next-intl/server
should probably be mocked for the time being (see also https://github.com/testing-library/react-testing-library/issues/1209).
Description
Jest fails to run when the tested source file has an import from
next-intl/server
.Similar to #452 and #488, but a different module.
Mandatory reproduction URL (CodeSandbox or GitHub repository)
https://github.com/sawyerh/next-intl-bug-examples
Reproduction description
Adding a line like the following to a source file:
Then running a Jest test on that source file, results in Jest reporting:
Expected behaviour
I would like to use Jest to test React components that import from
next-intl/server
without additional compiler config.