Tag: 酵素

错误:“ReactFifteenAdapter.js”中找不到模块'react-dom / test-utils'“,对于jest-styled-componentsconfiguration,使用了React 15.4.1

仅在使用React版本15.4.1configurationJest-Styled组件时出错。 我们不会升级React版本。 我们只需要configuration上面的反应版本。 我没有安装以下软件包 – 开玩笑风格组件 反应试验渲染器 酶到JSON 酶 – 接合体反应的-15 的package.json { "name": "app", "version": "0.0.1", "description": "", "engines": { "npm": ">=3", "node": ">=5" }, "scripts": { "analyze:clean": "rimraf stats.json", "preanalyze": "npm run analyze:clean", "analyze": "node ./internals/scripts/analyze.js", "extract-intl": "babel-node –presets latest,stage-0 — ./internals/scripts/extract-intl.js", "npmcheckversion": "node ./internals/scripts/npmcheckversion.js", "preinstall": "npm run npmcheckversion", "postinstall": "npm run build:dll", […]

反应酶types错误:无法读取未定义的属性'propTypes'

以下是我的React组件: import React from 'react' var PageLeftLower = React.createClass({ render:function(){ return(<a href="#">Quote Requests</a>); } }); module.exports = PageLeftLower; 所以,非常简单的React组件。 我刚开始使用Enzyme和Mocha进行testing,并编写了以下代码。 import expect from 'expect'; import React from 'react'; import {shallow} from 'enzyme'; import {PageLeftLower} from './PageLeftLower'; describe('Component : WholeTab',() => { it('renders without exploding', () => { expect(shallow(<PageLeftLower/>).length).toEqual(1); }); }); 当我执行它时,它输出以下警告: 组件:WholeTab警告:React.createElement:types不应该为null,undefined,boolean或number。 它应该是一个string(对于DOM元素)或ReactClass(对于复合组件)。 并出现以下错误: TypeError:无法读取未定义的属性“propTypes”。 […]

eslint应该列在项目的依赖关系中,而不是devDependencies

要么我不明白dependencies与devDependencies在节点100%还是eslint在这里只是错(不能正确分析这个): 3:1 error 'chai' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies 4:1 error 'chai-enzyme' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies 5:1 error 'enzyme' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies 7:1 error 'sinon' should be listed in the project's dependencies, not devDependencies import/no-extraneous-dependencies 9:1 error […]