Allow running one spec/suite in the web interface
This is the proper way to make it filter the spec list: https://github.com/pivotal/jasmine/blob/1_3_x/spec/runner.html I submitted the jasmine-jsreporter change as a pull request here: https://github.com/detro/jasmine-jsreporter/pull/2 Fixes #563.
Ben Alpert committed
Nov 24, 2013 at 00:53 UTC
3a75d7050198744caba60b2c7c5e0ef5154d4bad
2 files changed
+8
-2
test/lib/jasmine-execute.js
+6
-1
@@ -1,7 +1,12 @@
1
document.write('<style> @import "../vendor/jasmine/jasmine.css?_=' + (+new Date).toString(36) + '"; </style>');
2
3
;(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
+
10
// Clean up any nodes the previous test might have added.
11
env.afterEach(function() {
12
harness.removeNextSiblings(document.body);
vendor/jasmine-jsreporter/jasmine-jsreporter.js
+2
-1
@@ -113,7 +113,8 @@
113
reportSpecResults: function (spec) {
114
// Finish timing this spec and calculate duration/delta (in sec)
115
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;
118
},
119
120
reportSuiteResults: function (suite) {