gpt4 book ai didi

javascript - 失败: Cannot read property 'results' of undefined

转载 作者:行者123 更新时间:2023-11-27 22:31:38 26 4
gpt4 key购买 nike

测试失败时截取屏幕截图的片段

    afterEach(function() {

var spec = jasmine.getEnv().currentSpec;
var passed = spec.results().passed();

if (!passed) {
browser.takeScreenshot().then(function(png) {
writeScreenShot(png, "screenshot.png");
});
}

function writeScreenShot(data, filename) {
var stream = fs.createWriteStream(filename);
stream.write(new Buffer(data, 'base64'));
stream.end();
}

});

控制台错误

  Message:
Failed: Cannot read property 'results' of undefined
Stack:
TypeError: Cannot read property 'results' of undefined
at Object.<anonymous>
<小时/>

它在这里返回未定义

var spec = jasmine.getEnv().currentSpec;
console.log(spec);

看起来像是 Jasmine 2 造成的问题;也欢迎任何替代解决方案!我用的是 Jasmine 2

最佳答案

Jasmine 2.0 开始,不再支持 env.currentSpec

https://github.com/jasmine/jasmine/issues/1212

关于javascript - 失败: Cannot read property 'results' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39522228/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com