Skip to content

--experimental-test-coverage throws error: "TypeError: Cannot read properties of undefined (reading 'line')" #51552

Description

@nicusorflorin

Version

v20.11.0

Platform

Linux MyPC 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  1. Create a few basic tests
  2. Run them with the command NODE_V8_COVERAGE=./coverage node --test --test-reporter=junit --test-reporter-destination=results.xml --experimental-test-coverage -r ts-node/register test/**/*.spec.ts

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

100%

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

Should generate proper coverage

What do you see instead?

content of results.xml:

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
	<testsuite name="TestSuite1Name" time="0.016595" disabled="0" errors="0" tests="3" failures="0" skipped="0" hostname="MyPC">
		<testcase name="test name 1" time="0.007770" classname="test"/>
		<testcase name="test name 2" time="0.002685" classname="test"/>
		<testcase name="test name 3" time="0.001173" classname="test"/>
	</testsuite>
	<testsuite name="TestSuite2Name" time="0.013062" disabled="0" errors="0" tests="1" failures="0" skipped="0" hostname="MyPC">
		<testcase name="test name 1" time="0.007652" classname="test"/>
	</testsuite>
	<!-- Warning: Could not report code coverage. TypeError: Cannot read properties of undefined (reading 'line') -->
	<!-- tests 4 -->
	<!-- suites 2 -->
	<!-- pass 4 -->
	<!-- fail 0 -->
	<!-- cancelled 0 -->
	<!-- skipped 0 -->
	<!-- todo 0 -->
	<!-- duration_ms 4851.507124 -->
</testsuites>

Additional information

No response

Activity

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

    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