JSHint 警告即使使用 "mocha" 也未定义 Mocha 'beforeEach':true
JSHint warns that Mocha 'beforeEach' is not defined even when using "mocha": true
我在 Mocha 中使用 Ember-cli,我的测试导致 JSHint 测试失败(测试实际上通过了)。
'beforeEach' is not defined.
我尝试将 "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');
});
}
);
显然您需要关闭 ember cli 测试服务器并重新启动它。
我在 Mocha 中使用 Ember-cli,我的测试导致 JSHint 测试失败(测试实际上通过了)。
'beforeEach' is not defined.
我尝试将 "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');
});
}
);
显然您需要关闭 ember cli 测试服务器并重新启动它。