I understand that currentSpec reference is no longer available in beforeEach from jasmine 2.0.0 (Ref: https://github.com/pivotal/jasmine/issues/492)
Is there an alternative to find the current Spec or Suite(a nested suite) in beforeEach?
Thanks, vj.
You can use a reporter
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() {});
  });
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With