0
我不明白这个错误。为什么我不能使用import
?在流星测试中不能使用导入
import { chai } from 'meteor/practicalmeteor:chai';
^^^^^^
SyntaxError: Unexpected reserved word
package.js
Package.onTest(function(api) {
api.use('practicalmeteor:mocha');
api.addFiles('tests/test.js');
});
test.js
import { chai } from 'meteor/practicalmeteor:chai';
describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() {
chai.assert.equal(-1, [1,2,3].indexOf(5));
chai.assert.equal(-1, [1,2,3].indexOf(0));
});
});
});
当您使用ES5编译器而不是Meteor使用的ES6编译器时,通常会发生此错误。 – AlexCatch
@AlexCatch我如何改变这种情况?我没有选择es5,我正在使用Meteor 1.3 – user3142695
你在使用什么IDE? – AlexCatch