Error while loading config - You appear to be using a native ECMAScript module configuration file
Full error message
This error is coming up when I am making a pull request. There is a GitHub workflow audit that runs checks on the pull request and it loads the test file from another repository.
- name: Run Audits
run: npx jest audits/ch-2 --json --outputFile=audits/ch-2.json --noStackTrace
Test suite failed to run
/Users/frankukachukwu/StudioProjects/covid-19-estimator-tksilicon-js/babel.config.js: Error while loading config - You appear to be using a native ECMAScript module configuration file, which is only supported when running Babel asynchronously.
How do I solve this issue?Solutionsource: stackoverflow \u2197
TL;DR: Changing babel.config.<extension> to babel.config.cjs did the work. Check babel docs if you need a different config. This has got to do with Babel settings. The use of .mjs, cjs or .js extension for the babel.config.extension. In my case where I was running LTE Node 12.6.2. I needed this configuration at the root of my directory babel.config.cjs. cjs is what is applicable for Nodejs when using "type"="module". See more about it here on babel docs. module.exports = { presets: [ [ '@babel/preset-env', { targets: { node: 'current' } } ] ] }; And jest.config.cjs at the root too.
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/0ad6a2c593e0ed530dc44b307f34fe1d8b7e4eacdcfe2bffccd426a505f18473hash \u00b7 0ad6a2c593e0ed530dc44b307f34fe1d8b7e4eacdcfe2bffccd426a505f18473