每一个测试都要引入 expect, 可以创建一个test_helper.js 1234567import { expect } from 'expect'import sinon from 'sinon'global.expect = expectglobal.sinon = sinon`然后在`mocha.opt`中添加`--require ./test/test_helper.js Author: Chen YuLink: https://ezcook.de/2016/09/08/e6-b5-8b-e8-af-95-e5-b0-8f-e6-8a-80-e5-b7-a7/Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.TestPrevious Post移动端 Border-Radius 溢出处理Next PostCommand Line Cheat Sheet Related Articles 2017-08-22Mock Data for Node.js 2017-05-31Simple Guide of Jest 2017-04-21Usage of Chai 2016-08-28测试环境搭建(Mocha + Chai + Sinon) 2016-09-05编写测试 2016-08-29Usage of Nock Comment