1 | # karma-jasmine-html-reporter
|
---|
2 |
|
---|
3 | [![npm version](https://img.shields.io/npm/v/karma-jasmine-html-reporter.svg)](https://www.npmjs.com/package/karma-jasmine-html-reporter) [![npm downloads](https://img.shields.io/npm/dm/karma-jasmine-html-reporter.svg)](https://www.npmjs.com/package/karma-jasmine-html-reporter)
|
---|
4 |
|
---|
5 | Reporter that dynamically shows tests results at debug.html page.
|
---|
6 |
|
---|
7 | Jasmine 1.3 is not supported. For Jasmine < 3.0.0, use version 0.2.2
|
---|
8 |
|
---|
9 | ![alt tag](/screenshots/reporter_1.png)
|
---|
10 |
|
---|
11 | You can also run a describe block, or a single test.
|
---|
12 |
|
---|
13 | ![alt tag](/screenshots/reporter_2.png)
|
---|
14 |
|
---|
15 | ## Installation
|
---|
16 |
|
---|
17 | You can simply install `karma-jasmine-html-reporter` as a devDependency by:
|
---|
18 | ```bash
|
---|
19 | npm install karma-jasmine-html-reporter --save-dev
|
---|
20 | ```
|
---|
21 |
|
---|
22 | ## Configuration
|
---|
23 | ```js
|
---|
24 | // karma.conf.js
|
---|
25 | module.exports = function(config) {
|
---|
26 | config.set({
|
---|
27 | reporters: ['kjhtml']
|
---|
28 | });
|
---|
29 | };
|
---|
30 | ```
|
---|
31 | #### With options
|
---|
32 | In combination with multiple reporters you may want to disable terminal messages because it's already handled by another reporter.
|
---|
33 |
|
---|
34 | *Example using the 'karma-mocha-reporter' plugin*:
|
---|
35 | ```js
|
---|
36 | // karma.conf.js
|
---|
37 | module.exports = function(config) {
|
---|
38 | config.set({
|
---|
39 |
|
---|
40 | // Combine multiple reporters
|
---|
41 | reporters: ['kjhtml', 'mocha'],
|
---|
42 |
|
---|
43 | jasmineHtmlReporter: {
|
---|
44 | suppressAll: true, // Suppress all messages (overrides other suppress settings)
|
---|
45 | suppressFailed: true // Suppress failed messages
|
---|
46 | }
|
---|
47 |
|
---|
48 | });
|
---|
49 | };
|
---|
50 | ```
|
---|
51 |
|
---|
52 | You can pass a list of reporters as a CLI argument too:
|
---|
53 | ```bash
|
---|
54 | karma start --reporters kjhtml
|
---|
55 | ```
|
---|
56 |
|
---|
57 | ## Develop
|
---|
58 |
|
---|
59 | There's not much to this package.
|
---|
60 |
|
---|
61 | [`adapter.js`](src/lib/adapter.js), [`html.jasmine.reporter.js`](src/lib/html.jasmine.reporter.js), and [`jasmine.css`](src/css/jasmine.css) are copied with small adjustments from [`jasmine/lib/jasmine-core/boot.js`](https://github.com/jasmine/jasmine/blob/main/lib/jasmine-core/boot.js) and [`jasmine/lib/jasmine-core/jasmine-html.js`](https://github.com/jasmine/jasmine/blob/main/lib/jasmine-core/jasmine-html.js), and [`jasmine/lib/jasmine-core/jasmine.css`](https://github.com/jasmine/jasmine/blob/main/lib/jasmine-core/jasmine.css) respectively.
|
---|
62 |
|
---|
63 | Just pull over changes from Jasmine as needed. There is a script to help with that; just run `npm run build` and review the changes. Specifically, [`adapter.js`](src/lib/adapter.js) needs a lot of manual removals.
|
---|