(Chai) assert.isBoolean 不是函数 - 我做错了什么?

(Chai) assert.isBoolean is not a function - what i does wrong?

代码少部分:

driver.wait(function(){ 
    return driver.isElementPresent(webdriver.By.className(errElement));
}, 3000, 'Element' + errElement + ' is not found').then(function(binaryVariable){
    assert.isTrue(binaryVariable, 'is not True');
      /*console.log(binaryVariable);
        console.log(typeof(binaryVariable));*/
}); 

如果我启用调试打印,在控制台中会出现

true
boolean

意思是driver.wait returns布尔值,所以我尝试通过assert.isTrue来检查它。但我收到错误消息 assert.isTrue is not a function。我做错了什么?

你应该使用

var chai = require('chai');
chai.assert.isTrue(binaryVariable, 'is not True');

简单引用全局 assert 对象使用 NodeJS 自己的,它没有 isTrueisBoolean 方法。