From 44a2ee201d64d187a7eff32d2af7e9af8a4cebb5 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 3 Oct 2023 20:29:51 +1100 Subject: [PATCH] test_runner: fixing PR comments * 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 --- doc/api/test.md | 4 ++-- lib/internal/test_runner/reporter/lcov.js | 6 +++--- lib/test/reporters.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/api/test.md b/doc/api/test.md index e1a52ac56d756a..ea997dbf77de7d 100644 --- a/doc/api/test.md +++ b/doc/api/test.md @@ -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 diff --git a/lib/internal/test_runner/reporter/lcov.js b/lib/internal/test_runner/reporter/lcov.js index 0b037409dd661b..4703abd874556a 100644 --- a/lib/internal/test_runner/reporter/lcov.js +++ b/lib/internal/test_runner/reporter/lcov.js @@ -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 }); diff --git a/lib/test/reporters.js b/lib/test/reporters.js index 8a1c6f589af4ef..6316074e6e64aa 100644 --- a/lib/test/reporters.js +++ b/lib/test/reporters.js @@ -52,7 +52,7 @@ ObjectDefineProperties(module.exports, { enumerable: true, get() { lcov ??= require('internal/test_runner/reporter/lcov'); - return lcov; + return ReflectConstruct(lcov, arguments); }, }, });