Added the ability to associate trace information with failing specs
This is meant to aid in debugging failures, particularly intermittent failures, in cases where interactive debugging or console.log aren't suitable.
This commit is contained in:
@@ -1339,6 +1339,23 @@ describe('HtmlReporter', function() {
|
||||
}
|
||||
]
|
||||
};
|
||||
var failingSpecResultWithTrace = {
|
||||
id: 567,
|
||||
status: 'failed',
|
||||
description: 'a failing spec',
|
||||
fullName: 'a suite inner suite a failing spec',
|
||||
passedExpectations: [],
|
||||
failedExpectations: [
|
||||
{
|
||||
message: 'a failure message',
|
||||
stack: 'a stack trace'
|
||||
}
|
||||
],
|
||||
trace: [
|
||||
{ timestamp: 123, message: 'msg 1' },
|
||||
{ timestamp: 456, message: 'msg 1' }
|
||||
]
|
||||
};
|
||||
|
||||
var passingSuiteResult = {
|
||||
id: 1,
|
||||
@@ -1356,18 +1373,20 @@ describe('HtmlReporter', function() {
|
||||
reporter.suiteDone(passingSuiteResult);
|
||||
reporter.suiteDone(failingSuiteResult);
|
||||
reporter.suiteDone(passingSuiteResult);
|
||||
reporter.specStarted(failingSpecResultWithTrace);
|
||||
reporter.specDone(failingSpecResultWithTrace);
|
||||
reporter.jasmineDone({});
|
||||
});
|
||||
|
||||
it('reports the specs counts', function() {
|
||||
var alertBar = container.querySelector('.jasmine-alert .jasmine-bar');
|
||||
expect(alertBar.innerHTML).toMatch(/2 specs, 2 failure/);
|
||||
expect(alertBar.innerHTML).toMatch(/3 specs, 3 failures/);
|
||||
});
|
||||
|
||||
it('reports failure messages and stack traces', function() {
|
||||
var specFailures = container.querySelector('.jasmine-failures');
|
||||
|
||||
expect(specFailures.childNodes.length).toEqual(2);
|
||||
expect(specFailures.childNodes.length).toEqual(3);
|
||||
|
||||
var specFailure = specFailures.childNodes[0];
|
||||
expect(specFailure.getAttribute('class')).toMatch(/jasmine-failed/);
|
||||
@@ -1408,6 +1427,18 @@ describe('HtmlReporter', function() {
|
||||
expect(suiteStackTrace.innerHTML).toEqual('a stack trace');
|
||||
});
|
||||
|
||||
it('reports traces when present', function() {
|
||||
var specFailure = container.querySelectorAll(
|
||||
'.jasmine-spec-detail.jasmine-failed'
|
||||
)[2],
|
||||
trace = specFailure.querySelector('.jasmine-trace table'),
|
||||
rows;
|
||||
|
||||
expect(trace).toBeTruthy();
|
||||
rows = trace.querySelectorAll('tbody tr');
|
||||
expect(rows.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('provides links to focus on a failure and each containing suite', function() {
|
||||
var description = container.querySelector(
|
||||
'.jasmine-failures .jasmine-description'
|
||||
|
||||
Reference in New Issue
Block a user