Skip to content

Commit

Permalink
test_runner: fixing PR comments
Browse files Browse the repository at this point in the history
* Adds lcov reporter to docs examples
* Corrects comment with period after URL
* Use ReflectConstruct so that the lcov reporter class is usable as a
function
  • Loading branch information
philnash committed Oct 3, 2023
1 parent 8c390dc commit 44a2ee2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -662,11 +662,11 @@ to the test runner's output is required, use the events emitted by the
The reporters are available via the `node:test/reporters` module:

```mjs
import { tap, spec, dot, junit } from 'node:test/reporters';
import { tap, spec, dot, junit, lcov } from 'node:test/reporters';
```

```cjs
const { tap, spec, dot, junit } = require('node:test/reporters');
const { tap, spec, dot, junit, lcov } = require('node:test/reporters');
```

### Custom reporters
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/test_runner/reporter/lcov.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
const Transform = require('internal/streams/transform');

// This reporter is based on the LCOV format, as described here:
// https://ltp.sourceforge.net/coverage/lcov/geninfo.1.php. Excerpts from this
// documentation are included in the comments that make up the _transform
// function below.
// https://ltp.sourceforge.net/coverage/lcov/geninfo.1.php
// Excerpts from this documentation are included in the comments that make up
// the _transform function below.
class LcovReporter extends Transform {
constructor(options) {
super({ ...options, writableObjectMode: true, __proto__: null });
Expand Down
2 changes: 1 addition & 1 deletion lib/test/reporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ObjectDefineProperties(module.exports, {
enumerable: true,
get() {
lcov ??= require('internal/test_runner/reporter/lcov');
return lcov;
return ReflectConstruct(lcov, arguments);
},
},
});

0 comments on commit 44a2ee2

Please sign in to comment.