Skip to content

Commit

Permalink
Merge pull request facebook#594 from spicyj/skip-spec
Browse files Browse the repository at this point in the history
Allow running one spec/suite in the web interface
  • Loading branch information
zpao committed Nov 27, 2013
2 parents a7811fb + 3a75d70 commit 9886e40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion test/lib/jasmine-execute.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
document.write('<style> @import "../vendor/jasmine/jasmine.css?_=' + (+new Date).toString(36) + '"; </style>');

;(function(env){
env.addReporter(new jasmine.HtmlReporter);
var htmlReporter = new jasmine.HtmlReporter();
env.addReporter(htmlReporter);
env.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};

// Clean up any nodes the previous test might have added.
env.afterEach(function() {
harness.removeNextSiblings(document.body);
Expand Down
3 changes: 2 additions & 1 deletion vendor/jasmine-jsreporter/jasmine-jsreporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
reportSpecResults: function (spec) {
// Finish timing this spec and calculate duration/delta (in sec)
spec.finishedAt = new Date();
spec.durationSec = elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime());
// If the spec was skipped, reportSpecStarting is never called and spec.startedAt is undefined
spec.durationSec = spec.startedAt ? elapsedSec(spec.startedAt.getTime(), spec.finishedAt.getTime()) : 0;
},

reportSuiteResults: function (suite) {
Expand Down

0 comments on commit 9886e40

Please sign in to comment.