#React组件测试流程和规范 ### 测试依赖 - mocha - chai - enzyme ### 使用Enzyme测试 - shallow Rendering 测试虚拟dom - DOM Rendering 测试真实dom #### shallow 浅渲染,将组件渲染成虚拟dom对象,但是只渲染第一层,不渲染所有子组件 ```javascript import React from 'react'; import {shallow, mount, render} from 'enzyme'; import {expect} from 'chai'; import Button from '../src/index'; describe('Enzyme Shallow', function () { it('Button should be exist', function () { let button = shallow(