Sha256: 547a8714f84cbdd2bfb8a00020201a04c9ac2e557563e370983671e9f84aeeae

Contents?: true

Size: 1.99 KB

Versions: 55

Compression:

Stored size: 1.99 KB

Contents

describe('Exceptions:', function() {
  var env;

  beforeEach(function() {
    env = new j$.Env();
  });

  describe('with break on exception', function() {
    it('should not catch the exception', function() {
      env.catchExceptions(false);
      env.describe('suite for break on exceptions', function() {
        env.it('should break when an exception is thrown', function() {
          throw new Error('I should hit a breakpoint!');
        });
      });
      var spy = jasmine.createSpy('spy');

      try {
        env.execute();
        spy();
      }
      catch (e) {}

      expect(spy).not.toHaveBeenCalled();
    });
  });

  describe("with catch on exception", function() {
    it('should handle exceptions thrown, but continue', function(done) {
      var secondTest = jasmine.createSpy('second test');
      env.describe('Suite for handles exceptions', function () {
        env.it('should be a test that fails because it throws an exception', function() {
          throw new Error();
        });
        env.it('should be a passing test that runs after exceptions are thrown from a async test', secondTest);
      });

      var expectations = function() {
        expect(secondTest).toHaveBeenCalled();
        done();
      };

      env.addReporter({ jasmineDone: expectations });
      env.execute();
    });

    it("should handle exceptions thrown directly in top-level describe blocks and continue", function(done) {
      var secondDescribe = jasmine.createSpy("second describe");
      env.describe("a suite that throws an exception", function () {
        env.it("is a test that should pass", function () {
         this.expect(true).toEqual(true);
        });

        throw new Error("top level error");
      });
      env.describe("a suite that doesn't throw an exception", secondDescribe);

      var expectations = function() {
        expect(secondDescribe).toHaveBeenCalled();
        done();
      };

      env.addReporter({ jasmineDone: expectations });
      env.execute();
    });
  });
});

Version data entries

55 entries across 55 versions & 4 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/bootstrap-tagsinput/lib/jasmine/spec/core/ExceptionsSpec.js
tdiary-5.0.2 vendor/bundle/gems/jasmine-core-2.4.1/lib/jasmine-core/spec/core/ExceptionsSpec.js
tdiary-5.0.1 vendor/bundle/gems/jasmine-core-2.4.1/lib/jasmine-core/spec/core/ExceptionsSpec.js
jasmine-core-2.4.1 ./lib/jasmine-core/spec/core/ExceptionsSpec.js
jasmine-core-2.4.0 ./lib/jasmine-core/spec/core/ExceptionsSpec.js
upjs-rails-0.11.0 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.10.5 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.10.4 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.10.3 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.10.2 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.10.1 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.10.0 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.9.1 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.9.0 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.8.2 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.8.1 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.8.0 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.7.8 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.7.7 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js
upjs-rails-0.7.6 spec_app/vendor/assets/bower_components/jasmine/spec/core/ExceptionsSpec.js