Option "setupTestFrameworkScriptFile" was replaced by configuration "setupFilesAfterEnv", which supports multiple paths.
Please update your configuration.
I found this exact question here: setupTestFrameworkScriptFile is not supported error
I renamed my jest.config.js
to setUpTests.js
however that did not remove the deprecated error warning.
import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
configure({ adapter: new Adapter() })
package.json scripts
"scripts": {
"dev": "next -p 7777",
"build": "next build",
"start": "next -p 7777",
"test": "NODE_ENV=test jest --watch --no-cache",
"test-win": "SET NODE_ENV=test&& jest --watch"
}
"@types/enzyme": "^3.1.15",
"@types/jest": "^23.3.13",
"jest": "^24.1.0"
Jest
used to have a config option called setupTestFrameworkScriptFile
...
...but it was deprecated in favor of the newer setupFilesAfterEnv
in PR #7119 which shipped with version 24.0.0.
Since you are using Jest
^v24.1.0 you will need to use setupFilesAfterEnv
.
Just find where setupTestFrameworkScriptFile
is used in your Jest
config, rename it to setupFilesAfterEnv
, and put the single file it used to point to in an array and you should be good to go.
Example, change this jest.config.js
:
module.exports = {
...
setupTestFrameworkScriptFile: './setup.js',
...
}
...to this:
module.exports = {
...
setupFilesAfterEnv: ['./setup.js'],
...
}
If you are using create-react-app, change the key name at package.json
file
from
"jest": {
// ...
"setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.js",
to
"jest": {
// ...
"setupFilesAfterEnv": ["<rootDir>/src/setupTests.js"],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With