A
A
anriko2021-11-11 13:54:36
React
anriko, 2021-11-11 13:54:36

Why don't jest tests run? Jest encountered an unexpected token?

Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens eg when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.
By default "node_modules" folder is ignored by transformers.

{
  "name": "votesblock",
  "version": "1.0.0",
  "description": "блок голосования",
  "main": "./src/index.js",
  "scripts": {
    "build": ".\\node_modules\\.bin\\webpack --mode production",
    "livebuild": ".\\node_modules\\.bin\\webpack-dev-server --mode development --progress --history-api-fallback --hot  --color",
    "test": "jest"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.16.0",
    "@babel/preset-env": "^7.16.0",
    "@babel/preset-react": "^7.16.0",
    "@babel/preset-stage-0": "^7.8.3",
    "babel-core": "^7.0.0-bridge.0",
    "babel-jest": "^27.3.0",
    "babel-loader": "^7.1.2",
    "css-loader": "^0.28.7",
    "extract-text-webpack-plugin": "^3.0.2",
    "html-webpack-plugin": "^5.4.0",
    "jest": "^27.3.1",
    "react-test-renderer": "^16.1.1",
    "webpack": "^5.58.2",
    "webpack-cli": "^4.9.1",
    "webpack-dev-server": "^4.3.1",
    "webpack-shell-plugin-next": "^2.2.2"
  },
  "dependencies": {
    "connected-react-router": "^6.9.1",
    "firebase": "^9.1.3",
    "history": "^4.10.1",
    "mini-css-extract-plugin": "^2.4.2",
    "normalize.css": "^8.0.1",
    "prop-types": "^15.6.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-redux": "^7.2.6",
    "react-router-dom": "^5.3.0",
    "redux": "^4.1.1"
  },
  "jest": {
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
      "\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
    }
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2015-02-24
@Nc_Soft

service mysql start
service mysqld start

P
Puma Thailand, 2015-02-24
@opium

If you do not have logs available, then it is logical that you are trying to run it not as root,
you need to do something like
sudo service mysql restart

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question