Remove jasmine.CATCH_EXCEPTIONS
- HTMLReporters should be rewritten to make this sort of thing easier. - Fix HTMLReporter try/catch switch - We can't really call resultCallback & throw, so that's been reverted for now.
This commit is contained in:
@@ -34,9 +34,7 @@ describe('Exceptions:', function() {
|
||||
|
||||
describe('with break on exception', function() {
|
||||
it('should not catch the exception', function() {
|
||||
var oldCatch = jasmine.CATCH_EXCEPTIONS;
|
||||
jasmine.CATCH_EXCEPTIONS = false;
|
||||
env = new jasmine.Env();
|
||||
env.catchExceptions(false);
|
||||
var suite = 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!');
|
||||
@@ -50,9 +48,6 @@ describe('Exceptions:', function() {
|
||||
dont_change = 'oops I changed';
|
||||
}
|
||||
catch (e) {}
|
||||
finally {
|
||||
jasmine.CATCH_EXCEPTIONS = oldCatch;
|
||||
}
|
||||
|
||||
expect(dont_change).toEqual('I will never change!');
|
||||
});
|
||||
|
||||
@@ -158,25 +158,6 @@ describe("Spec", function() {
|
||||
expect(spec.status()).toBe('failed');
|
||||
});
|
||||
|
||||
it("calls the resultCallback with a failure when an exception occurs in the spec fn", function() {
|
||||
//TODO: one day we should pass a stack with this.
|
||||
var resultCallback = originalJasmine.createSpy('resultCallback'),
|
||||
spec = new jasmine.Spec({
|
||||
fn: function() {
|
||||
throw new Error();
|
||||
},
|
||||
catchExceptions: true,
|
||||
resultCallback: resultCallback
|
||||
});
|
||||
|
||||
expect(resultCallback).not.toHaveBeenCalled();
|
||||
spec.execute();
|
||||
expect(resultCallback).toHaveBeenCalledWith(
|
||||
originalJasmine.objectContaining({status: 'failed'})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
it("throws when an exception occurs in the spec fn if catchExceptions is false", function() {
|
||||
//TODO: one day we should pass a stack with this.
|
||||
var resultCallback = originalJasmine.createSpy('resultCallback'),
|
||||
|
||||
@@ -11,7 +11,10 @@ describe("HtmlReporter", function() {
|
||||
|
||||
body = document.createElement("body");
|
||||
fakeDocument = { body: body, location: { search: "" } };
|
||||
htmlReporter = new jasmine.HtmlReporter(fakeDocument, null, function(fn) { fn() });
|
||||
htmlReporter = new jasmine.HtmlReporter(fakeDocument, null, {
|
||||
catchingExceptions: function() { return true; },
|
||||
catchExceptions: function() { }
|
||||
}, {yieldForRender: function(fn) { fn() }});
|
||||
});
|
||||
|
||||
function fakeSpec(name) {
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script type="text/javascript" src=".././spec/core/BaseSpec.js"></script>
|
||||
<script type="text/javascript" src=".././spec/core/CustomMatchersSpec.js"></script>
|
||||
<script type="text/javascript" src=".././spec/core/EnvSpec.js"></script>
|
||||
<script type="text/javascript" src=".././spec/core/ExceptionsSpec.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user