我在本指南之后写了一些mocha测试:https://guide.meteor.com/testing.html
我的测试看起来像这样:
import { chai } from 'meteor/practicalmeteor:chai';
var client = require('webdriverio').remote({
desiredCapabilities: {
platformName: 'iOS',
app: 'net.company.SafariLauncher',
udid: '123123123123abc',
deviceName: 'iPhone',
}
});
//i can also replace the upper code by:
//import webdriverio from 'webdriverio';
// or
//const webdriverio = require('webdriverio');
//but the error stays the same
describe('my module', function (done) {
it('should return -1 when the value is not present', function() {
assert.equal(-1, [1,2,3].indexOf(4));
});
});
错误与标题中一样:
Error: ENOENT, no such file or directory '/node_modules/webdriverio/build/lib/protocol'
我按照上面提到的指南中所述进行测试:
meteor test --driver-package=practicalmeteor:mocha
更新:
我忘了提到我在npm install webdriverio上有这个错误:
├── UNMET PEER DEPENDENCY mocha@3.5.0
├── UNMET PEER DEPENDENCY react@15.4.2
├── UNMET PEER DEPENDENCY react-dom@15.4.2
├── webdriverio@4.8.0
└── UNMET PEER DEPENDENCY webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc
由于我可以使用wdio testrunner运行mocha测试,我忽略了该消息。我认为这不是错误的问题,但仍然可能是重要的信息。