Задать вопрос
@anriko

Почему не запускают тесты jest Jest encountered an unexpected token?

Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. 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"
    }
  }
}
  • Вопрос задан
  • 1330 просмотров
Подписаться 1 Простой 1 комментарий
Помогут разобраться в теме Все курсы
  • Нетология
    Frontend-разработка на React
    10 недель
    Далее
  • ProductStar
    Разработка на React
    6 недель
    Далее
  • Яндекс Практикум
    React-разработчик
    3 месяца
    Далее
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
от 250 000 до 300 000 ₽
ITK academy Нижний Новгород
от 50 000 до 90 000 ₽
ITK academy Екатеринбург
от 50 000 до 90 000 ₽