Skip to content

Commit 9886e40

Browse files
committed
Merge pull request facebook#594 from spicyj/skip-spec
Allow running one spec/suite in the web interface
2 parents a7811fb + 3a75d70 commit 9886e40

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test/lib/jasmine-execute.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
document.write('<style> @import "../vendor/jasmine/jasmine.css?_=' + (+new Date).toString(36) + '"; </style>');
22

33
;(function(env){
4-
env.addReporter(new jasmine.HtmlReporter);
4+
var htmlReporter = new jasmine.HtmlReporter();
5+
env.addReporter(htmlReporter);
6+
env.specFilter = function(spec) {
7+
return htmlReporter.specFilter(spec);
8+
};
9+
510
// Clean up any nodes the previous test might have added.
611
env.afterEach(function() {
712
harness.removeNextSiblings(document.body);

vendor/jasmine-jsreporter/jasmine-jsreporter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@
113113
reportSpecResults: function (spec) {
114114
// Finish timing this spec and calculate duration/delta (in sec)
115115
spec.finishedAt = new Date();
116-
spec.durationSec = elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime());
116+
// If the spec was skipped, reportSpecStarting is never called and spec.startedAt is undefined
117+
spec.durationSec = spec.startedAt ? elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime()) : 0;
117118
},
118119

119120
reportSuiteResults: function (suite) {

0 commit comments

Comments
 (0)