Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
154
rated 0 times [  160] [ 6]  / answers: 1 / hits: 17062  / 5 Years ago, thu, april 18, 2019, 12:00:00

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"

More From » testing

 Answers
17

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'],
...
}

[#52223] Friday, April 12, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
blaisep

Total Points: 748
Total Questions: 95
Total Answers: 108

Location: Federated States of Micronesia
Member since Sun, May 16, 2021
3 Years ago
blaisep questions
Wed, Dec 16, 20, 00:00, 4 Years ago
Sun, Aug 16, 20, 00:00, 4 Years ago
Tue, Nov 12, 19, 00:00, 5 Years ago
Mon, Nov 11, 19, 00:00, 5 Years ago
;