Запуск --inspect-brk выдает ошибку «ReferenceError: Неизвестная опция: .debug.» - PullRequest
0 голосов
/ 30 января 2020

Выполнение шагов на https://jestjs.io/docs/en/troubleshooting.

В пакете. json создано задание:

"test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",

Получение следующей ошибки:

 ReferenceError: Unknown option: .debug. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.

      at throwUnknownError (node_modules/babel-jest/node_modules/@babel/core/lib/config/validation/options.js:123:11)
          at Array.forEach (<anonymous>)

Попытался очистить node_modules и установить заново, но это не помогло.

Работает:

  • node v10.17.0.
  • React v16. 12.0

Полный пакет. json:

{
  "name": "tsc-poc",
  "version": "0.0.1",
  "private": true,
  "engines": {
    "yarn": "^1.19.0"
  },
  "devDependencies": {
    "cheerio": "^1.0.0-rc.3",
    "concurrently": "5.0.2",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.2",
    "eslint-config-airbnb": "18.0.1",
    "eslint-config-prettier": "6.9.0",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-prettier": "3.1.2",
    "eslint-plugin-react": "^7.18.0",
    "expect": "^24.9.0",
    "html-differ": "^1.4.0",
    "jest-plugin-context": "^2.9.0",
    "js-beautify": "^1.10.3",
    "node-sass": "^4.13.1",
    "prettier": "^1.19.1",
    "purify-css": "^1.2.5",
    "react-scripts": "3.3.0"
  },
  "peerDependencies": {
    "@material-ui/styles": "^4.3.3"
  },
  "dependencies": {
    "@date-io/date-fns": "1.3.13",
    "@fortawesome/fontawesome-svg-core": "^1.2.26",
    "@fortawesome/free-solid-svg-icons": "^5.12.0",
    "@fortawesome/react-fontawesome": "^0.1.8",
    "@material-ui/core": "4.8.3",
    "@material-ui/icons": "^4.2.1",
    "@material-ui/pickers": "^3.2.9",
    "@sentry/browser": "5.11.1",
    "@testing-library/react": "^9.4.0",
    "autoprefixer-stylus": "1.0.0",
    "babel-polyfill": "^6.26.0",
    "classnames": "^2.2.6",
    "clsx": "^1.0.4",
    "core-js": "^3.6.4",
    "date-fns": "^2.9.0",
    "deep-object-diff": "^1.1.0",
    "formik": "^2.1.2",
    "history": "^4.10.1",
    "html-to-react": "^1.4.2",
    "memoize-one": "5.1.1",
    "node-polyglot": "^2.4.0",
    "oidc-client": "^1.10.1",
    "prop-types": "^15.6.0",
    "querystring-es3": "^0.2.0",
    "react": "^16.12.0",
    "react-beautiful-dnd": "12.2.0",
    "react-dom": "^16.12.0",
    "react-input-mask": "^2.0.4",
    "react-refetch": "^3.0.0-1",
    "react-router-dom": "5.1.2",
    "serve": "11.3.0",
    "shallowequal": "^1.1.0",
    "webstorage-polyfill": "^1.0.1",
    "whatwg-fetch": "^3.0.0",
    "yup": "^0.28.0"
  },
  "scripts": {
    "start": "REACT_APP_ENV=${REACT_APP_ENV:-development} react-scripts start",
    "build": "EXTEND_ESLINT=true react-scripts build",
    "build:dev": "REACT_APP_ENV=development yarn build",
    "build:deploy": "REACT_APP_ENV=deploy yarn build",
    "eject": "react-scripts eject",
    "test": "REACT_APP_ENV=test react-scripts test",
    "test:debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
    "lint": "node_modules/.bin/eslint --ext .jsx --ext .js .",
    "lintfix": "node_modules/.bin/eslint --fix --ext .jsx --ext .js .",
    "preinstall": "$npm_execpath --silent run checkyarn",
    "checkyarn": "echo \"$npm_execpath\" | grep -q \"yarn\\.js$\" || (echo '⚠️  Use yarn not npm! ⚠️ ' && echo && exit 1)"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie < 11",
    "not op_mini all"
  ]
}

1 Ответ

1 голос
/ 30 января 2020

Оказывается, вам нужно использовать реагирующие сценарии вместо непосредственного выполнения шутки при использовании CRA: https://create-react-app.dev/docs/debugging-tests/

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...