karma-runner / karma-runner/karma

[Question] How to add custom object to the results object from this.onSpecComplete

Open
#2,159 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.