我有一个看起来像这样的Mocha测试文件:
var expect = require('chai').expect
var muting = require('../muting')
describe('muting', function () {
describe('init()', function () {
it('should inject an object into twitter', function () {
var twitter = 'twitter'
muting.init(twitter)
expect(muting.twitter).to.equal(twitter)
})
})
})
当我mocha
从CLI运行时,它将成功运行测试。
当我运行standard
(JavaScript Standard Style的可执行文件)时,我在Mocha的框架函数中遇到如下错误:
standard: Use JavaScript Standard Style (https://github.com/feross/standard)
c:\..\test\index.js:5:0: 'describe' is not defined.
c:\..\test\index.js:6:2: 'describe' is not defined.
c:\..\test\index.js:7:4: 'it' is not defined.
使Standard不抱怨这些功能的最干净方法是什么?
it
常规的非测试代码,它将通过掉毛吗?换一种说法。可以仅限于测试班吗?