如何确认我使用的是什么版本的 Jasmine? [英] How can I confirm what version of Jasmine I'm using?
问题描述
如果我记得 Jasmine 中有一个命令可以将我正在运行的 Jasmine 的确切版本记录到控制台,但我不记得它是什么了.我很肯定我以前在某个地方看到过这个,现在我真的需要它,我在任何地方都找不到它.有人知道是什么吗?
If I recall there is a command in Jasmine that will log the exact version of Jasmine I'm running to the console, but I can't remember what it is. I am positive I have seen this before somewhere, and now that I actually need it I can't find it anywhere. Does anyone know what it is?
使用 jasmine.getEnv().versionString()
的已发布解决方案不起作用 - 对于阅读此内容的任何模组,修复该问题是否会更好地作为一个新问题开始,还是从这里继续?
The posted solution of using jasmine.getEnv().versionString()
isn't working - to any mods reading this, would fixing that issue be better to start as a new question, or continue here?
推荐答案
简单记录版本号试试:
if (jasmine.version) { //the case for version 2.0.0
console.log('jasmine-version:' + jasmine.version);
}
else { //the case for version 1.3
console.log('jasmine-version:' + jasmine.getEnv().versionString());
}
我使用这个小辅助函数:
I use this little helper function:
this.isJasmineV2 = function () {
return (jasmine.version && jasmine.version.charAt(0) === "2");
//version 1.3 uses this syntax: jasmine.getEnv().versionString()
};
这篇关于如何确认我使用的是什么版本的 Jasmine?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!