据我所知,来自jasmine 2.0.0的beforeEach中不再提供currentSpec参考 (参考:https://github.com/pivotal/jasmine/issues/492)
是否可以在beforeEach中找到当前的Spec或Suite(嵌套套件)?
谢谢, VJ。
答案 0 :(得分:0)
您可以使用记者
describe("outer", function() {
var specDescription, specFullName;
(function() {
jasmine.getEnv().addReporter({
suiteStarted: function(result) {
specDescription = result.description;
specFullName = result.fullName;
}
});
})();
beforeEach(function() {
console.debug(specDescription);
console.debug(specFullName);
});
describe("test1", function() {
it("bla bla", function() {});
});
describe("test2", function() {
it("bla bla", function() {});
});
}