Test Suite Failed To Run - Unknown option: .preset
See original GitHub issueError Description: When running jest for a simple unit test of javascript code I get the error Test suite failed to run Unknown option: .preset
Below are the files to reproduce the error:
package.json
{ "name": "RelocationTrackerApp", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "jest", "start-debug": "webpack-dev-server --open --config webpack.dev.js", "build-release": "webpack --config webpack.prod.js" }, "keywords": [], "author": "", "license": "ISC", "devDependencies": { "@babel/core": "^7.9.0", "@babel/preset-env": "^7.9.5", "@babel/preset-react": "^7.9.4", "@testing-library/react": "^10.0.3", "babel-jest": "^25.5.1", "babel-loader": "^8.1.0", "jest": "^25.5.0", "react-test-renderer": "^16.13.1", "webpack": "^4.42.1", "webpack-cli": "^3.3.11", "webpack-dev-server": "^3.10.3", "webpack-merge": "^4.2.2" }, "dependencies": { "react": "^16.13.1", "react-bootstrap": "^1.0.1", "react-dom": "^16.13.1", "react-router-dom": "^5.1.2" } }
.babelrc
{ "preset": ["@babel/preset-env", "@babel/preset-react"] }
sum.test.js ` const sum = require(‘./sum’);
test(‘properly ads two numbers’, () => { expect(sum(1, 2)).toBe(3) }) `
Below is the actual error: tests/sum.test.js ● Test suite failed to run
Unknown option: .preset. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
at throwUnknownError (node_modules/@babel/core/lib/config/validation/options.js:123:27)
at node_modules/@babel/core/lib/config/validation/options.js:108:5
at Array.forEach (<anonymous>)
at validateNested (node_modules/@babel/core/lib/config/validation/options.js:84:21)
at validate (node_modules/@babel/core/lib/config/validation/options.js:75:10)
at node_modules/@babel/core/lib/config/config-chain.js:174:34
at cachedFunction (node_modules/@babel/core/lib/config/caching.js:62:27)
at cachedFunction.next (<anonymous>)
at evaluateSync (node_modules/gensync/index.js:244:28)
at sync (node_modules/gensync/index.js:84:14)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top GitHub Comments
plaese speak solve method
is you question well ,im has same question