mardi 31 octobre 2017

setupTestFrameworkScriptFile is not supported error

Hello I am trying to use Jest+Enzyme to test my react components. I am not using create react app so I find the error I am getting very strange. Does anybody know what I am doing wrong here?

Here is the error:

Out of the box, Create React App only supports overriding these Jest options:

• collectCoverageFrom • coverageReporters • coverageThreshold • snapshotSerializers.

These options in your package.json Jest configuration are not currently supported by Create React App:

• setupTestFrameworkScriptFile

If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.

This is my test-setup.js

import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';

configure({ adapter: new Adapter() });

This is my package.json

 {
      "name": "duplo-plugin-starter-react",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "directories": {
        "doc": "docs"
      },
      "jest": {
        "setupTestFrameworkScriptFile": "<rootDir>/test-setup.js"
      },
      "scripts": {
        "test": "react-scripts-ts test --env=jsdom",
        "build": "webpack",
        "start": "webpack-dev-server --progress --inline"
      },
      "repository": {
        "type": "git",
        "url": "git@github.corp.dyndns.com:vcharlesthompson/duplo-plugin-starter-react.git"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "@types/react": "^16.0.18",
        "@types/react-dom": "^16.0.2",
        "react": "^16.0.0",
        "react-dom": "^16.0.0",
        "source-map-loader": "^0.2.3"
      },
      "devDependencies": {
        "@types/enzyme": "^3.1.1",
        "@types/jest": "^21.1.5",
        "awesome-typescript-loader": "^3.2.3",
        "css-loader": "^0.28.7",
        "enzyme": "^3.1.0",
        "enzyme-adapter-react-16": "^1.0.2",
        "less": "^2.7.3",
        "less-loader": "^4.0.5",
        "react-addons-test-utils": "^15.6.2",
        "react-scripts-ts": "^2.8.0",
        "react-test-renderer": "^16.0.0",
        "style-loader": "^0.19.0",
        "typescript": "^2.5.3",
        "webpack": "^3.8.1",
        "webpack-dev-server": "^2.9.3"
      }
 }

Aucun commentaire:

Enregistrer un commentaire