【发布时间】:2015-10-07 03:44:43
【问题描述】:
我将 Ember-cli 与 Mocha 一起使用,我的测试导致 JSHint 测试失败(测试实际上通过了)。
'beforeEach' 没有定义。
我尝试将"mocha": true 选项添加到我的.jshintrc 中,正如the docs 中所说的那样。
我还尝试将其添加到"globals": { "beforeEach": true }。
我正在使用ember test --server 运行测试。
/* jshint expr:true */
import { expect } from 'chai';
import {
describeModel,
it
} from 'ember-mocha';
describeModel(
'user',
'User',
{
// Specify the other units that are required for this test.
needs: []
},
function() {
beforeEach(function(){
this.model = this.subject({
email: 'test@example.com'
});
});
// Replace this with your real tests.
it('exists', function() {
// var store = this.store();
expect(this.model.get('email')).to.equal('test@example.com');
});
}
);
【问题讨论】:
-
添加 `import { beforeEach } from 'mocha';` 使警告静音,但为什么 JSHint 没有选择配置。
标签: javascript ember.js mocha.js ember-cli jshint