Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Nextjs to ignore babel.config.js

I Have a nextjs app, I want babel customization to run jest suite for testing, however when I configure babel.config.js file jest runs successfuly, but nextjs is also taking the configuration I dont want that, I want nextjs to ignore babel.config.js, How do I do that?

like image 682
sriram hegde Avatar asked Mar 31 '20 12:03

sriram hegde


1 Answers

Just create a different filename for tests (like babel.config.test.js) and make jest use it.

I assume that your jest config inside package.json

// package.json

{
  "jest": {
    "transform": {
      "\\.js$": ["babel-jest", { "configFile": "./babel.config.test.js" }]
    }
  }
}
like image 110
felixmosh Avatar answered Oct 08 '22 03:10

felixmosh