gustavodidomenico
gustavodidomenico

Reputation: 4681

HTML report using Karma unit testing environment

I am using the karma runner to watch and execute my jasmine unit tests. Everything is working very well:

WARN [karma]: Port 9876 in use
INFO [karma]: Karma v0.12.16 server started at http://localhost:9877/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 35.0.1916 (Windows 7)]: Connected on socket OgjbuvCr3-_2Tn4eBIP7 wth id 15958859
..............................................................................................
Chrome 35.0.1916 (Windows 7): Executed 123 of 123 SUCCESS (12.052 secs / 12.051 secs)

However I am trying to use a custom reporter to generate some html files:

npm install karma-jasmine-html-reporter -g

And if I choose to generate the html report in the karma.conf.js file:

...
reporters: ['html'],
...

The karma environment no longer successfully starts:

...
INFO [Chrome 35.0.1916 (Windows 7)]: Connected on socket 3IOACm6k0JKfDQN3DXii with id 16839683
Chrome 35.0.1916 (Windows 7) ERROR
Uncaught ReferenceError: jasmineRequire is not defined
    at C:/Users/gustavo_domenico/AppData/Roaming/npm/node_modules/karma-jasmine-html-reporter/src/lib/html.jasmine.reporter.js?3cbecfb23689b35e47d04a0870eb69d60182fdab:24

I tried to install the karma-jasmine and others html based reports but the same error persist. I really appreciate any help.

Upvotes: 2

Views: 1896

Answers (1)

user3911076
user3911076

Reputation: 21

Had the same problem by using karma-jasmine-html-reporter plugin. In my case it was related to karma-jasmine version (I used an old one). Make sure you use the latest.

Upvotes: 2

Related Questions