question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test Suite Failed To Run - Unknown option: .preset

See original GitHub issue

Error 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:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
Maskduxiancommented, Jul 25, 2020

plaese speak solve method

1reaction
Maskduxiancommented, Jul 25, 2020

is you question well ,im has same question

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest Error - Test Suite Failed To Run - Unknown option: .preset
I think this is because it is presets not preset in your .babelrc. By the way the unknown option is not .preset ,...
Read more >
while running the test i am getting this error,can anyone help ...
Test suite failed to run. ReferenceError: [BABEL] /Users/Documents/my-app/src/setupTests.js: Unknown option: base.configFile.
Read more >
Jest with Vue.js and Babel Unknown Option - drumcoder.co.uk
I was trying to run a Jest unit test against a vue.js component. I was getting the following error: FAIL src/components/UserList.spec.js ○ Test...
Read more >
babel/preset-react
If you have automatic runtime enabled, adding @babel/plugin-transform-react-jsx-self or @babel/plugin-transform-react-jsx-source will error.
Read more >
Testing React Apps - Jest
We are using the babel-jest package and the react babel preset to transform our code inside of the test environment. Also see using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found