Report loading errors as loading errors, not afterAll errors
[#24901981]
This commit is contained in:
@@ -422,6 +422,49 @@ describe("Env integration", function() {
|
||||
env.execute();
|
||||
});
|
||||
|
||||
it("tags top-level afterAll failures with a type", function(done) {
|
||||
var env = new jasmineUnderTest.Env();
|
||||
|
||||
env.addReporter({jasmineDone: function(result) {
|
||||
expect(result.failedExpectations[0].globalErrorType).toEqual('afterAll');
|
||||
done();
|
||||
}});
|
||||
|
||||
env.it('has a spec', function() {});
|
||||
|
||||
env.afterAll(function() {
|
||||
debugger;
|
||||
throw 'nope';
|
||||
});
|
||||
|
||||
env.execute();
|
||||
});
|
||||
|
||||
it("does not tag suite afterAll failures with a type", function(done) {
|
||||
var env = new jasmineUnderTest.Env(),
|
||||
reporter = {
|
||||
jasmineDone: function() {
|
||||
expect(reporter.suiteDone).toHaveBeenCalled();
|
||||
done();
|
||||
},
|
||||
suiteDone: jasmine.createSpy('suiteDone').and.callFake(function(result) {
|
||||
expect(result.failedExpectations[0].globalErrorType).toBeFalsy();
|
||||
})
|
||||
}
|
||||
|
||||
env.addReporter(reporter);
|
||||
|
||||
env.describe('a suite', function() {
|
||||
env.it('has a spec', function() {});
|
||||
|
||||
env.afterAll(function() {
|
||||
throw 'nope';
|
||||
});
|
||||
});
|
||||
|
||||
env.execute();
|
||||
});
|
||||
|
||||
it("fails all underlying specs when the beforeAll fails", function (done) {
|
||||
var env = new jasmineUnderTest.Env(),
|
||||
reporter = jasmine.createSpyObj('fakeReporter', [ "specDone", "jasmineDone" ]);
|
||||
@@ -1991,10 +2034,12 @@ describe("Env integration", function() {
|
||||
expect(e.failedExpectations).toEqual([
|
||||
{
|
||||
passed: false,
|
||||
globalErrorType: 'load',
|
||||
message: 'Uncaught SyntaxError: Unexpected end of input'
|
||||
},
|
||||
{
|
||||
passed: false,
|
||||
globalErrorType: 'load',
|
||||
message: 'Uncaught Error: ENOCHEESE'
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -195,16 +195,23 @@ describe("HtmlReporter", function() {
|
||||
reporter.jasmineStarted({});
|
||||
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My After All Exception' }] });
|
||||
reporter.suiteDone({ status: 'failed', failedExpectations: [{ message: 'My Other Exception' }] });
|
||||
reporter.jasmineDone({ failedExpectations: [{ message: 'Global After All Failure' }, { message: 'Other Global' }] });
|
||||
reporter.jasmineDone({ failedExpectations: [
|
||||
{ message: 'Global After All Failure', globalErrorType: 'afterAll' },
|
||||
{ message: 'Other Global' },
|
||||
{ message: 'Your JS is borken', globalErrorType: 'load' }
|
||||
] });
|
||||
|
||||
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
|
||||
|
||||
expect(alertBars.length).toEqual(5);
|
||||
expect(alertBars.length).toEqual(6);
|
||||
expect(alertBars[1].innerHTML).toMatch(/My After All Exception/);
|
||||
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-errored');
|
||||
expect(alertBars[2].innerHTML).toMatch(/My Other Exception/);
|
||||
expect(alertBars[3].innerHTML).toMatch(/Global After All Failure/);
|
||||
expect(alertBars[3].innerHTML).toMatch(/AfterAll Global After All Failure/);
|
||||
// TODO: What about this?
|
||||
expect(alertBars[4].innerHTML).toMatch(/Other Global/);
|
||||
|
||||
expect(alertBars[5].innerHTML).toMatch(/Error during loading: Your JS is borken/);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user