如何确认我正在使用的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()
无法正常工作 - 对于读取此问题的任何mod,会更好地解决这个问题作为一个新问题开始,还是继续在这里?
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?
推荐答案
要简单记录版本号,请尝试:
To simply log the version number try:
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屋!