Merge branch 'bonkevin-html-reporter-with-duration'
* Merges #2073 from @bonkevin * Adds spec duration to HTML reporter
This commit is contained in:
@@ -557,6 +557,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
'a',
|
'a',
|
||||||
{ href: specHref(resultNode.result) },
|
{ href: specHref(resultNode.result) },
|
||||||
specDescription
|
specDescription
|
||||||
|
),
|
||||||
|
createDom(
|
||||||
|
'span',
|
||||||
|
{ className: 'jasmine-spec-duration' },
|
||||||
|
'(' + resultNode.result.duration + 'ms)'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -229,6 +229,9 @@ body {
|
|||||||
.jasmine_html-reporter .jasmine-specs li.jasmine-excluded a:before {
|
.jasmine_html-reporter .jasmine-specs li.jasmine-excluded a:before {
|
||||||
content: "• ";
|
content: "• ";
|
||||||
}
|
}
|
||||||
|
.jasmine_html-reporter .jasmine-specs li .jasmine-spec-duration {
|
||||||
|
margin-left: 14px;
|
||||||
|
}
|
||||||
.jasmine_html-reporter .jasmine-description + .jasmine-suite {
|
.jasmine_html-reporter .jasmine-description + .jasmine-suite {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ describe('HtmlReporter', function() {
|
|||||||
expect(duration.innerHTML).toMatch(/finished in 0.1s/);
|
expect(duration.innerHTML).toMatch(/finished in 0.1s/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('reports the suite and spec names with status', function() {
|
it('reports the suite names with status, and spec names with status and duration', function() {
|
||||||
const container = document.createElement('div'),
|
const container = document.createElement('div'),
|
||||||
getContainer = function() {
|
getContainer = function() {
|
||||||
return container;
|
return container;
|
||||||
@@ -532,7 +532,8 @@ describe('HtmlReporter', function() {
|
|||||||
fullName: 'A Suite with a spec',
|
fullName: 'A Suite with a spec',
|
||||||
status: 'passed',
|
status: 'passed',
|
||||||
failedExpectations: [],
|
failedExpectations: [],
|
||||||
passedExpectations: [{ passed: true }]
|
passedExpectations: [{ passed: true }],
|
||||||
|
duration: 1230
|
||||||
};
|
};
|
||||||
reporter.specStarted(specResult);
|
reporter.specStarted(specResult);
|
||||||
reporter.specDone(specResult);
|
reporter.specDone(specResult);
|
||||||
@@ -549,7 +550,8 @@ describe('HtmlReporter', function() {
|
|||||||
fullName: 'A Suite inner suite with another spec',
|
fullName: 'A Suite inner suite with another spec',
|
||||||
status: 'passed',
|
status: 'passed',
|
||||||
failedExpectations: [],
|
failedExpectations: [],
|
||||||
passedExpectations: [{ passed: true }]
|
passedExpectations: [{ passed: true }],
|
||||||
|
duration: 1240
|
||||||
};
|
};
|
||||||
reporter.specStarted(specResult);
|
reporter.specStarted(specResult);
|
||||||
reporter.specDone(specResult);
|
reporter.specDone(specResult);
|
||||||
@@ -567,7 +569,8 @@ describe('HtmlReporter', function() {
|
|||||||
fullName: 'A Suite inner with a failing spec',
|
fullName: 'A Suite inner with a failing spec',
|
||||||
status: 'failed',
|
status: 'failed',
|
||||||
failedExpectations: [{}],
|
failedExpectations: [{}],
|
||||||
passedExpectations: []
|
passedExpectations: [],
|
||||||
|
duration: 2090
|
||||||
};
|
};
|
||||||
reporter.specStarted(specResult);
|
reporter.specStarted(specResult);
|
||||||
reporter.specDone(specResult);
|
reporter.specDone(specResult);
|
||||||
@@ -614,6 +617,9 @@ describe('HtmlReporter', function() {
|
|||||||
expect(specLink.getAttribute('href')).toEqual(
|
expect(specLink.getAttribute('href')).toEqual(
|
||||||
'/?foo=bar&spec=A Suite with a spec'
|
'/?foo=bar&spec=A Suite with a spec'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const specDuration = spec.childNodes[1];
|
||||||
|
expect(specDuration.innerHTML).toEqual('(1230ms)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has an options menu', function() {
|
it('has an options menu', function() {
|
||||||
|
|||||||
@@ -523,6 +523,11 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
'a',
|
'a',
|
||||||
{ href: specHref(resultNode.result) },
|
{ href: specHref(resultNode.result) },
|
||||||
specDescription
|
specDescription
|
||||||
|
),
|
||||||
|
createDom(
|
||||||
|
'span',
|
||||||
|
{ className: 'jasmine-spec-duration' },
|
||||||
|
'(' + resultNode.result.duration + 'ms)'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -331,6 +331,10 @@ body {
|
|||||||
&.jasmine-excluded a:before {
|
&.jasmine-excluded a:before {
|
||||||
content: $passing-mark + $space;
|
content: $passing-mark + $space;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jasmine-spec-duration {
|
||||||
|
margin-left: $margin-unit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user