Reputation: 11
I am developing a NextJS application, I am using Turbopack and I am using Jest as a testing framework. I need to include some plugins to be able to run my tests. Here are the plugins:
{
"env": {
"test" : {
"presets": [
"@babel/preset-env",
"@babel/preset-react", "@babel/preset-typescript"
],
"plugins": ["@babel/plugin-transform-react-jsx"]
}
}
}
My issue is that Turbopack does not support babel and asks to remove the .babelrc file. If I remove .babelrc I can't launch my tests because jest's parser does not support tsx files. My current solution is to place my .babelrc in a "backup" folder when I want to run my dev environment and bring it back to the root of my project when I want to test but it is not ideal.
I wish I could pass a Turbopack option or a node/npm option to say "just behave as if the ".babelrc" file was not there.
I know I can have a .npmignore file but it want my .babelrc to be seen when I launch npm test and not to be seen when I launch npm run dev. Do someone have an idea to resolve this issue ?
Upvotes: 0
Views: 28