How to add custom object to the results object from this.onSpecComplete

20 views
Skip to first unread message

Devan Shah

unread,
Jun 8, 2016, 10:18:16 AM6/8/16
to karma-users
How can one go about adding a custom object to results object in the following context: 

```js
  this.onSpecComplete = function (browser, result) {
       console.log(result.myObject)
  }
```

I saw that the karma-coverage plugin does something similar:

```js
  this.onSpecComplete = function (browser, result) {
    if (!result.coverage) return
    collectors[browser.id].add(result.coverage)
  }
```

How does the karma-coverage plugin populate the result.coverage object to make it accessible in the onSpecComplete function.  

Or any other way to pass some sort of object from the jasmine testcases to a reporter and write those results to a file

Can I use: window.__karma__.store function to store custom json objects and then access in reporter?

would it be possible to communicate from framework to the reporter to provide it a specific object. Can store be accessed in the reporter.

Cant create framework with an adapter as that would override the karma start function which means that other frameworks would not work. Want to write a frame work which would work in parallel with other frameworks.

Reply all
Reply to author
Forward
0 new messages