-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License | ||
|
||
Copyright (C) 2011-2013 Vojta Jína and contributors. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
of the Software, and to permit persons to whom the Software is furnished to do | ||
so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# karma-jasmine-html-reporter | ||
|
||
> Reporter that dynamically shows tests results at debug.html page. | ||
## Installation | ||
|
||
The easiest way is to keep `karma-jasmine-html-reporter` as a devDependency in your `package.json`. | ||
```json | ||
{ | ||
"devDependencies": { | ||
"karma": "~0.10", | ||
"karma-jasmine-html-reporter": "~0.1" | ||
} | ||
} | ||
``` | ||
|
||
You can simple do it by: | ||
```bash | ||
npm install karma-jasmine-html-reporter --save-dev | ||
``` | ||
|
||
## Configuration | ||
```js | ||
// karma.conf.js | ||
module.exports = function(config) { | ||
config.set({ | ||
|
||
reporters: ['html'] | ||
|
||
}); | ||
}; | ||
``` | ||
|
||
You can pass list of reporters as a CLI argument too: | ||
```bash | ||
karma start --reporters html | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "karma-jasmine-html-reporter", | ||
"version": "0.1.5", | ||
"description": "A Karma plugin. Dynamically displays tests results at debug.html page", | ||
"main": "./src/index.js", | ||
"keywords": [ | ||
"karma-plugin", | ||
"karma-reporter", | ||
"html" | ||
], | ||
"repository": { | ||
"url": "" | ||
}, | ||
"author": "", | ||
"dependencies": { | ||
"karma-jasmine": "~0.2" | ||
}, | ||
"peerDependencies": { | ||
"karma": ">=0.9" | ||
}, | ||
"license": "MIT", | ||
"devDependencies": {}, | ||
"readmeFilename": "README.md" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; } | ||
|
||
.html-reporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; } | ||
.html-reporter a { text-decoration: none; } | ||
.html-reporter a:hover { text-decoration: underline; } | ||
.html-reporter p, .html-reporter h1, .html-reporter h2, .html-reporter h3, .html-reporter h4, .html-reporter h5, .html-reporter h6 { margin: 0; line-height: 14px; } | ||
.html-reporter .banner, .html-reporter .symbol-summary, .html-reporter .summary, .html-reporter .result-message, .html-reporter .spec .description, .html-reporter .spec-detail .description, .html-reporter .alert .bar, .html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; } | ||
.html-reporter .banner .version { margin-left: 14px; } | ||
.html-reporter #jasmine_content { position: fixed; right: 100%; } | ||
.html-reporter .version { color: #aaaaaa; } | ||
.html-reporter .banner { margin-top: 14px; } | ||
.html-reporter .duration { color: #aaaaaa; float: right; } | ||
.html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; } | ||
.html-reporter .symbol-summary li { display: inline-block; height: 8px; width: 14px; font-size: 16px; } | ||
.html-reporter .symbol-summary li.passed { font-size: 14px; } | ||
.html-reporter .symbol-summary li.passed:before { color: #5e7d00; content: "\02022"; } | ||
.html-reporter .symbol-summary li.failed { line-height: 9px; } | ||
.html-reporter .symbol-summary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; } | ||
.html-reporter .symbol-summary li.disabled { font-size: 14px; } | ||
.html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; } | ||
.html-reporter .symbol-summary li.pending { line-height: 17px; } | ||
.html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; } | ||
.html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; } | ||
.html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; } | ||
.html-reporter .bar.failed { background-color: #b03911; } | ||
.html-reporter .bar.passed { background-color: #a6b779; } | ||
.html-reporter .bar.skipped { background-color: #bababa; } | ||
.html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; } | ||
.html-reporter .bar.menu a { color: #333333; } | ||
.html-reporter .bar a { color: white; } | ||
.html-reporter.spec-list .bar.menu.failure-list, .html-reporter.spec-list .results .failures { display: none; } | ||
.html-reporter.failure-list .bar.menu.spec-list, .html-reporter.failure-list .summary { display: none; } | ||
.html-reporter .running-alert { background-color: #666666; } | ||
.html-reporter .results { margin-top: 14px; } | ||
.html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; } | ||
.html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; } | ||
.html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; } | ||
.html-reporter.showDetails .summary { display: none; } | ||
.html-reporter.showDetails #details { display: block; } | ||
.html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; } | ||
.html-reporter .summary { margin-top: 14px; } | ||
.html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; } | ||
.html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; } | ||
.html-reporter .summary li.passed a { color: #5e7d00; } | ||
.html-reporter .summary li.failed a { color: #b03911; } | ||
.html-reporter .summary li.pending a { color: #ba9d37; } | ||
.html-reporter .description + .suite { margin-top: 0; } | ||
.html-reporter .suite { margin-top: 14px; } | ||
.html-reporter .suite a { color: #333333; } | ||
.html-reporter .failures .spec-detail { margin-bottom: 28px; } | ||
.html-reporter .failures .spec-detail .description { background-color: #b03911; } | ||
.html-reporter .failures .spec-detail .description a { color: white; } | ||
.html-reporter .result-message { padding-top: 14px; color: #333333; white-space: pre; } | ||
.html-reporter .result-message span.result { display: block; } | ||
.html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var createPattern = function(path) { | ||
return {pattern: path, included: true, served: true, watched: false}; | ||
}; | ||
|
||
var initReporter = function(files, baseReporterDecorator) { | ||
|
||
baseReporterDecorator(this); | ||
|
||
files.unshift(createPattern(__dirname + '/lib/adapter.js')); | ||
files.unshift(createPattern(__dirname + '/lib/html.jasmine.reporter.js')); | ||
files.unshift(createPattern(__dirname + '/css/jasmine.css')); | ||
}; | ||
|
||
initReporter.$inject = ['config.files', 'baseReporterDecorator']; | ||
|
||
module.exports = { | ||
'reporter:html': ['type', initReporter] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
(function(window){ | ||
|
||
/** | ||
* Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference. | ||
*/ | ||
jasmineRequire.html(jasmine); | ||
/** | ||
* Create the Jasmine environment. This is used to run all specs | ||
* in a project. | ||
*/ | ||
var env = jasmine.getEnv(); | ||
|
||
/** | ||
* ## Runner Parameters | ||
* | ||
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface. | ||
*/ | ||
|
||
var queryString = new jasmine.QueryString({ | ||
getWindowLocation: function() { return window.location; } | ||
}); | ||
|
||
var catchingExceptions = queryString.getParam("catch"); | ||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions); | ||
|
||
/** | ||
* ## Reporters | ||
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any). | ||
*/ | ||
var htmlReporter = new jasmine.HtmlReporter({ | ||
env: env, | ||
onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); }, | ||
getContainer: function() { return document.body; }, | ||
createElement: function() { return document.createElement.apply(document, arguments); }, | ||
createTextNode: function() { return document.createTextNode.apply(document, arguments); }, | ||
timer: new jasmine.Timer() | ||
}); | ||
|
||
/** | ||
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript. | ||
*/ | ||
|
||
env.addReporter(htmlReporter); | ||
|
||
/** | ||
* Filter which specs will be run by matching the start of the full name against the `spec` query param. | ||
*/ | ||
var specFilter = new jasmine.HtmlSpecFilter({ | ||
filterString: function() { return queryString.getParam("spec"); } | ||
}); | ||
|
||
env.specFilter = function(spec) { | ||
return specFilter.matches(spec.getFullName()); | ||
}; | ||
|
||
htmlReporter.initialize(); | ||
|
||
})(window); |
Oops, something went wrong.