Sitelet https://github.com/nodejs/node/issues/47669
Skip to content

--experimental-test-coverage cannot be used with --test #47669

Description

@piranna

Version

v20.0.0

Platform

Linux executive 5.19.0-40-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 23 21:39:15 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

test

What steps will reproduce the bug?

Running node --test lookup for tests in the current project folder. When adding the --experimental-test-coverage flag I get the error node: --experimental-test-coverage cannot be used with --test, and if I remove the --test flag and left the --experimental-test-coverage flag alone, it throws me to a REPL without looking for the tests. Only way to run the tests with code coverage is by executing it explicitly with node --experimental-test-coverage test.js, passing test files as arguments.

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior? Why is that the expected behavior?

When running node --experimental-test-coverage, it should implicitly call --test and look for the test files, or allow to have both --test and --experimental-test-coverage flags in the same command.

What do you see instead?

Error node: --experimental-test-coverage cannot be used with --test, or a REPL if I remove the --test flag.

Additional information

No response

Activity

  1. richardlau commented on Apr 22, 2023

    @richardlau
    Member

    #47651 mentions it is the first step towards addressing this.

  2. richardlau commented on Apr 22, 2023

    @richardlau
    Member

    This is a documented limitation which looks like it's being worked on.

    node/doc/api/test.md

    Lines 423 to 432 in 7b39e80

    The test runner's code coverage functionality has the following limitations,
    which will be addressed in a future Node.js release:
    * Although coverage data is collected for child processes, this information is
    not included in the coverage report. Because the command line test runner uses
    child processes to execute test files, it cannot be used with
    `--experimental-test-coverage`.
    * Source maps are not supported.
    * Excluding specific files or directories from the coverage report is not
    supported.

  3. cjihrig commented on Apr 22, 2023

    @cjihrig
    Contributor

    FWIW, I should have a PR to address this soon - possibly in the next day or so.

  4. piranna commented on Apr 22, 2023

    @piranna
    ContributorAuthor

    #47651 mentions it is the first step towards addressing this.

    Thanks for clarifying, subscribed to that PR.

  5. added
    known limitationIssues that are identified as known limitations.
    test_runnerIssues and PRs related to the test runner subsystem.
    on Apr 22, 2023
  6. muturgan commented on Jun 3, 2023

    @muturgan

    will it be added in version 18?

  7. piranna commented on Jun 3, 2023

    @piranna
    ContributorAuthor

    will it be added in version 18?

    It's already included.

  8. ccucui commented on Jul 7, 2023

    @ccucui

    Hi guys, any release date of the fix for v18?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    known limitationIssues that are identified as known limitations.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions