dtabuenc / karma-html-reporter Goto Github PK
View Code? Open in Web Editor NEWKarma Html Reporter Plugin
License: MIT License
Karma Html Reporter Plugin
License: MIT License
Is it possible to have an output like karma-story-reporter, with a tree.
Currently
Expected
I think it's easier to read
Hello, I just wanted to let you know that with this reporter, I am getting the following error:
ERROR [config]: Invalid config file!
SyntaxError: Unexpected identifier.
My command prompt tells me that the error is on the following line of code:
reporters: ['progress', 'html'],
However, I'm following the instructions outlined on both the npm page and the github account.
Any ideas on what I might be doing wrong?
NPM Project
https://www.npmjs.com/package/karma-html-reporter
When viewing the file in the browser, it does not show what is in the describe it shows [object Object]. I started looking at this and discovered that the suitesToArray function the suiteName is actually coming out as [object Object] from _.map ?
Cannot write HTML report ENOENT
Currently this reporter is broken if used with karma 0.11. It seems that all karma reporter plugins have to be fixed to be compatible with 0.11.
See this for example.
Example:
INFO [launcher]: Starting browser Chrome
INFO [Chrome 35.0.1916 (Mac OS X 10.8.5)]: Connected on socket EK2rYY15FeDz98z-wxD4 with id 75186479
Chrome 35.0.1916 (Mac OS X 10.8.5) ERROR
Uncaught Error: Module name "user.controller" has not been loaded yet for context: _
http://requirejs.org/docs/errors.html#notloaded
at /Users/user/Sites/project/node_modules/requirejs/require.js:141
ERROR [karma]: [TypeError: Cannot set property 'results' of undefined]
TypeError: Cannot set property 'results' of undefined
at onBrowserComplete (/Users/user/Sites/project/node_modules/karma-html-reporter/index.js:43:25)
at null.<anonymous> (/Users/user/Sites/project/node_modules/karma/lib/events.js:15:22)
at EventEmitter.emit (events.js:117:20)
at onComplete (/Users/user/Sites/project/node_modules/karma/lib/browser.js:145:13)
at Socket.<anonymous> (/Users/user/Sites/project/node_modules/karma/lib/events.js:15:22)
at Socket.EventEmitter.emit [as $emit] (events.js:117:20)
at SocketNamespace.handlePacket (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/manager.js:518:38)
at WebSocket.Transport.onMessage (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/transport.js:369:20)
at Parser.<anonymous> (/Users/user/Sites/project/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
Also crashes if an extra }, ) function, var f = ; etc.
All small errors.
Karma does not crash if this reporter is disabled.
Just a heads up.
I would like to use the middleDirPath fix added June 5, 2014 but there was no version bump when this change was made. Can I get a version bump ?
Thanks!
Instead of getting PhantomJS.....html is there any way to specify what this filename is?
My package.json dependencies:
"devDependencies": {
"gulp": "^3.9.1",
"gulp-typescript": "^2.12.1",
"jasmine": "^2.4.1",
"karma": "~0.13.22",
"karma-chrome-launcher": "~0.2.3",
"karma-jasmine": "^0.3.7",
"run-sequence": "^1.1.5",
"typescript": "^1.8.7",
"karma-html-reporter": "~0.2.7",
"karma-unicorn-reporter": "~0.1.4"
}
My karma.conf.js reporters line: reporters: ['progress', 'html'],
My gulp task that runs without problems:
gulp.task('test', function(){
exec('karma start', function(err){
console.log(err ? err : 'Karma server running');
});
});
When I run karma start without gulp I get the report through the terminal (Executed x of x SUCCESS), but as when I use gulp, the debug page remains blank. (I'm using chrome browsers: ['Chrome'],
)
I have three browsers being tested: Firefox, Chrome, and Edge. However, only one browser's results show up. It's typically Firefox, but it's sometimes Chrome.
Instead of the default title "Test Results", i want to pass the custom information which will be derived from variable at run time.
How can i set the custom Title ?
Failures go waaaaay off screen to the right
Hi
I am getting an incorrectly nesting if I have two test files where only one has deeply nested describe.
Here is the output from my text console when running:
Group 1 - No nesting
✔ displays correctly
Group 2 - No nesting
✔ Displays correctly
Group with nesting
Nested "describe" block
✔ should display inside "group with nesting" (skipped)
✔ should still display inside "group with nesting" (skipped)
I extracted this example from a private repository.
The above structure is what I expect. However, the HTML report incorrectly displays the nested describe block as being below Group 2. And the heading Group with nesting
disappears!
something like this is displayed:
Group 1 - No nesting
✔ displays correctly
Group 2 - No nesting
✔ Displays correctly
Nested "describe" block #UH OH! NESTED BELOW WRONG GROUP!!!
✔ should display inside "group with nesting" (skipped)
✔ should still display inside "group with nesting" (skipped)
It appears as if Nested "describe" block
were added directly below Group 2
, which is incorrect.
Can you help me debugging this strange thing? Or, can you help me with a test that can show this error in the source code.
Fatal error: Cannot read property 'suites' of undefined
In new Karma, template does not work.
I was trying to test this reporter and when I ran my test suite I got the following error.
INFO [reporter.osx]: OSX Notification Center reporter started at http://localhost:1337
INFO [karma]: Karma v0.10.10 server started at http://localhost:9876/
INFO [launcher]: Starting browser Safari
INFO [reporter.osx]: node-osx-notifier exited with code 8
INFO [Safari 7.0.3 (Mac OS X 10.9.2)]: Connected on socket 76zbAucpGbOAabZx085C
Safari 7.0.3 (Mac OS X 10.9.2): Executed 1 of 197 SUCCESS (0 secs / 0.019 secs)
ERROR [karma]: [TypeError: Cannot read property 'suites' of undefined]
TypeError: Cannot read property 'suites' of undefined
at getOrCreateSuite (/Users/ryan/Source/webview/node_modules/karma-html-reporter/index.js:99:42)
at [object Object].specSuccess.specSkipped.specFailure (/Users/ryan/Source/webview/node_modules/karma-html-reporter/index.js:85:15)
at [object Object].onSpecComplete (/Users/ryan/Source/webview/node_modules/karma/lib/reporters/Base.js:80:12)
at [object Object].EventEmitter.emit (events.js:117:20)
at [object Object].onResult (/Users/ryan/Source/webview/node_modules/karma/lib/browser.js:177:13)
at Socket.EventEmitter.emit [as $emit] (events.js:117:20)
at SocketNamespace.handlePacket (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transport.js:387:20)
at Parser.<anonymous> (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
at Parser.EventEmitter.emit (events.js:95:17)
at finish (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:288:16)
at Parser.expectHandler (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:299:15)
at Parser.add (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at Parser.<anonymous> (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:298:18)
at Parser.add (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at expectData (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:296:16)
at Parser.<anonymous> (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:317:11)
at Parser.add (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at Parser.opcodeHandlers.1 (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:316:14)
at Parser.processPacket (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:533:8)
at Parser.add (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Socket.<anonymous> (/Users/ryan/Source/webview/node_modules/karma/node_modules/socket.io/lib/transports/websocket/hybi-16.js:141:17)
at Socket.EventEmitter.emit (events.js:117:20)
at Socket.<anonymous> (_stream_readable.js:746:14)
at Socket.EventEmitter.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at TCP.onread (net.js:528:21)
Help?
TypeError: Cannot set property 'results' of undefined
at onBrowserComplete (C:\Users\434852\Desktop\karma\node_modules\karma-html-reporter\index.js:43:25)
at null. (C:\Users\434852\Desktop\karma\node_modules\karma\lib\events.js:15:22)
Running npm audit
on a project that uses karma-html-reporter includes output like:
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=4.17.11 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ 80dd5990e7597a6d3477fd57c9c80cb2efe87974eb098711a1cf87cab15… │
│ │ [dev] │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ 80dd5990e7597a6d3477fd57c9c80cb2efe87974eb098711a1cf87cab15… │
│ │ > karma-html-reporter > lodash │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://nodesecurity.io/advisories/782 │
└───────────────┴──────────────────────────────────────────────────────────────┘
If dependency on lodash gets updated, then there'd be no issues reported for karma-html-reporter.
Hello, maybe I didn't undestood how it works, but is there a chance of opening the resulted html in the browser?
The Karma runner by default opens and shows the status of the tests, and I would want to show the results in another browser tab
console INFO 07 06 2016 13:31:54.538:WARN [preprocess]: Can not load "coverage", it is not registered!
Perhaps you are missing some plugin?
console INFO 07 06 2016 13:31:54.544:WARN [reporter]: Can not load "spec", it is not registered!
Perhaps you are missing some plugin?
console INFO 07 06 2016 13:31:54.544:WARN [reporter]: Can not load "junit", it is not registered!
Perhaps you are missing some plugin?
console INFO 07 06 2016 13:31:54.544:WARN [reporter]: Can not load "coverage", it is not registered!
Perhaps you are missing some plugin?
[13:31:54] console INFO '_karma-jenkins' errored after 37 ms
[13:31:54] console INFO Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
at error (D:\src\thin-monitor2\node_modules\di\lib\injector.js:22:12)
at Object.parent.get (D:\src\thin-monitor2\node_modules\di\lib\injector.js:9:13)
at get (D:\src\thin-monitor2\node_modules\di\lib\injector.js:54:19)
at D:\src\thin-monitor2\node_modules\karma\lib\server.js:138:20
at Array.forEach (native)
at Server._start (D:\src\thin-monitor2\node_modules\karma\lib\server.js:137:21)
at invoke (D:\src\thin-monitor2\node_modules\di\lib\injector.js:75:15)
at Server.start (D:\src\thin-monitor2\node_modules\karma\lib\server.js:102:18)
at Gulp.<anonymous> (D:\src\thin-monitor2\gulp-tasks\testing-tasks.js:106:5)
at module.exports (D:\src\thin-monitor2\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (D:\src\thin-monitor2\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (D:\src\thin-monitor2\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (D:\src\thin-monitor2\node_modules\orchestrator\index.js:134:8)
at runNextSet (D:\src\thin-monitor2\node_modules\run-sequence\index.js:88:16)
at Gulp.onTaskEnd (D:\src\thin-monitor2\node_modules\run-sequence\index.js:77:5)
at emitOne (events.js:82:20)
config.set({
reporters: ['spec', 'junit', 'coverage', 'html'],
// the default configuration
htmlReporter: {
outputDir: process.env.WORKSPACE || '../reports/karma_html', // where to put the reports
templatePath: null, // set if you moved jasmine_template.html
focusOnFailures: true, // reports show failures on start
namedFiles: false, // name files instead of creating sub-directories
pageTitle: 'ThinMonitor2 Unit Tests', // page title for reports; browser info by default
urlFriendlyName: true, // simply replaces spaces with _ for files/dirs
// reportName: 'report-summary-filename' // report summary filename; browser info by default
},
plugins: [
'karma-html-reporter'
],
junitReporter : {
outputDir: process.env.WORKSPACE || '../reports/jUnit', // results will be saved as $outputDir/$browserName.xml
outputFile: 'test-results.xml',
useBrowserName: false // add browser name to report and classes names
},
coverageReporter: {
reporters:[
{
type : 'cobertura',
dir : '../reports/coverage/cobertura/'
},
{
type: 'html',
dir: '../reports/coverage/html/'
},
{
type: 'text-summary'
// dir: '../reports/coverage/text/'
}
]
},
preprocessors: {
'../src/js/**/*.js': 'coverage'
},
frameworks: ['jasmine', 'jasmine-matchers'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// For headless Chrome, see https://gist.github.com/addyosmani/5336747
// We really ought to test on the same client the end-users use
browsers: ['PhantomJS'],
files: [
...
],
exclude: [
'js/app.js' // Not used in tests: see ../test/lib/jasmine-tr.js for instantiation of thinMonitor.
],
port: 9876,
colors: false,
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
autoWatch: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
@dtabuenc you've included a number of vulnerability updates (e.g., lodash ^4.17.13 to address CVE-2019-10744). I'm certain other projects that depend on karma-html-reporter
are getting flagged for these vulnerabilities due to transitive dependencies. Would you be able to cut a patch release (v0.2.8)?
ERROR [karma]: [TypeError: options must be a string or an object]
TypeError: options must be a string or an object
at new WriteStream (fs.js:1798:11)
at Object.fs.createWriteStream (fs.js:1784:10)
at c:\Users\<username>\Documents\Aptana Studio 3 Workspace\admin-gui\node_modules\karma-html-reporter\index.js:89:22
at FSReqWrap.oncomplete (fs.js:82:15)
.write(string, encoding, offset, length) is deprecated. Use write(string[, offset[, length]][, encoding]) instead.
on node 0.12, latest karma i get this warning when using karma-html-reporter
.write(string, encoding, offset, length) is deprecated. Use write(string[, offset[, length]][, encoding]) instead.
Karma runs 58 tests of mine, but only the first suite is ever displayed.
Passing 58 specs
App namespace
should be defined
should be defined
should be defined
And the rest of index.html is blank. I am running version 0.1.1 of karma-html-reporter.
Hi @dtabuenc ,
What should be the file name. The are options for custom title & everything but no option to mention the file name?
Hi, How can I get report in tabular form with time taken for test execution?
Do I need to update jasmine_template.html for it? If yes, how to implement?
karma-html-reporter doesn't play nice with node 4.x
An old API is used to handle writeStream errors, which now throws an error.
Here's the stack trace:
TypeError: options must be a string or an object
at new WriteStream (fs.js:1799:11)
at Object.fs.createWriteStream (fs.js:1785:10)
at /home/RIAstar/dev/trasys/seed/angular-app-seed/node_modules/karma-html-reporter/index.js:89:22
at /home/RIAstar/dev/trasys/seed/angular-app-seed/node_modules/karma/lib/helper.js:82:7
I am getting this error.
using "karma": "0.12.2",
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.