display slow tests after suite has finished
This commit is contained in:
parent
9aec3c2cd8
commit
ae839dbd3f
@ -77,6 +77,7 @@ module.exports = function(grunt) {
|
||||
browser: 'phantomjs',
|
||||
headless: false,
|
||||
chromePoll: 100,
|
||||
reportSlowerThan: -1,
|
||||
version: '2.2.0',
|
||||
timeout: 10000,
|
||||
styles: [],
|
||||
@ -269,6 +270,7 @@ module.exports = function(grunt) {
|
||||
tabstop = 2,
|
||||
thisRun = {},
|
||||
suites = {},
|
||||
slowSpecs = [],
|
||||
currentSuite;
|
||||
|
||||
status.failed = 0;
|
||||
@ -366,6 +368,11 @@ module.exports = function(grunt) {
|
||||
failureMessages: []
|
||||
};
|
||||
|
||||
if (options.reportSlowerThan !== -1 &&
|
||||
specMetaData.duration > options.reportSlowerThan) {
|
||||
slowSpecs.push(specMetaData);
|
||||
}
|
||||
|
||||
suites[currentSuite].tests++;
|
||||
|
||||
var color = 'yellow',
|
||||
@ -465,6 +472,14 @@ module.exports = function(grunt) {
|
||||
logSummary(thisRun.summary);
|
||||
}
|
||||
|
||||
if (options.reportSlowerThan !== -1 && slowSpecs.length > 0) {
|
||||
grunt.log.writeln(chalk.yellow('Some specs were slower than ' + options.reportSlowerThan + ' ms:'));
|
||||
grunt.log.writeln();
|
||||
_.forEach(slowSpecs, function (slowSpec) {
|
||||
grunt.log.writeln(chalk.yellow(slowSpec.fullName) + chalk.red(' (' + slowSpec.duration + ' ms)'));
|
||||
})
|
||||
}
|
||||
|
||||
if (options.junit && options.junit.path) {
|
||||
writeJunitXml(suites);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
}
|
||||
|
||||
var ChromeReporter = {
|
||||
lastSpecStartTime: null,
|
||||
jasmineStarted: function (suiteInfo) {
|
||||
console.log('Jasmine started: ', new Date().toString());
|
||||
pushToQueue({
|
||||
@ -23,12 +24,14 @@
|
||||
});
|
||||
},
|
||||
specStarted: function (result) {
|
||||
this.lastSpecStartTime = new Date();
|
||||
pushToQueue({
|
||||
type: 'jasmine.specStarted',
|
||||
payload: result
|
||||
});
|
||||
},
|
||||
specDone: function (result) {
|
||||
result.duration = new Date() - this.lastSpecStartTime;
|
||||
pushToQueue({
|
||||
type: 'jasmine.specDone',
|
||||
payload: result
|
||||
|
Loading…
Reference in New Issue
Block a user