You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a line like the following to a source file:
import{getTranslations}from"next-intl/server";
Then running a Jest test on that source file, results in Jest reporting:
node_modules/next-intl/dist/esm/server.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export{default as getRequestConfig}from"./server/getRequestConfig.js";export{default as getFormatter}from"./server/getFormatter.js";export{default as getNow}from"./server/getNow.js";export{default as getTimeZone}from"./server/getTimeZone.js";export{default as getTranslations}from"./server/getTranslations.js";export{default as getMessages}from"./server/getMessages.js";export{default as getLocale}from"./server/getLocale.js";export{setRequestLocale as unstable_setRequestLocale}from"./server/RequestLocale.js";
^^^^^^
SyntaxError: Unexpected token 'export'
Expected behaviour
I would like to use Jest to test React components that import from next-intl/server without additional compiler config.
The text was updated successfully, but these errors were encountered:
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.
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.The text was updated successfully, but these errors were encountered: