代码之家  ›  专栏  ›  技术社区  ›  Theo Itzaris

<rootdir>似乎无法处理package.json

  •  0
  • Theo Itzaris  · 技术社区  · 7 年前

    我想在我的测试中用酶来开玩笑,基于那个医生 https://airbnb.io/enzyme/docs/guides/jest.html ,我有点变了 package.json 像这样:

    .... "jest": { "setupTestFrameworkScriptFile": "<rootDir>/setupTests.js", "moduleFileExtensions": [ "js", "jsx" ], "moduleDirectories": [ "node_modules", "bower_components", "shared" ] }

    我创造了 setupTests.js ,并将其添加到项目根目录中:

    import { configure } from 'enzyme' import Adapter from 'enzyme-adapter-react-16' configure({ adapter: new Adapter() })

    项目结构:

    setupTests.js package.json .babelrc .eslintrc jest.config.js \client \components \__TESTS__ footer.spec.js actions.spec.js ..... \pages \server

    问题是当我跑的时候 jest 我知道错误,因为它找不到 设置测试.js :

    enter image description here

    我也应该在网页包上做些改变吗?

    0 回复  |  直到 7 年前