我不断收到描述不是函数的错误。 我该如何解决这个问题?
// Require chai.js expect module for assertions
var chai = require('chai');
var expect = require('chai').expect;
chai.use = require ('chai-as-promised')
// Application Server
var serverUri = '0.0.0.0:3000';
// Official selenium webdriver testing setup
var webdriver = require('selenium-webdriver');
describe('basic test', function () {
var driver;
before(function(){
// Start of test use this
driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();
console.log("Selenium Webdriver Chrome Started");
});
after(function(){
// End of test use this.
driver.quit();
});
it('should be on correct page', function (done) {
this.timeout(10000);
driver.get(serverUri);
driver.getTitle().then(function(title) {
expect(title).to.equal('Some String Here');
done();
console.log("Selenium Webdriver Chrome Shutdown");
})
});
});
运行此错误后得到的错误是:
描述不是函数
答案 0 :(得分:0)
你忘了要求mocha(假设你安装了它)..
尝试添加
const { describe, it, before, after } = require('mocha');