Skip to content

Platform-Specific Path Assertion Error: Windows vs. Unix Root Path Mismatch in Tests #2490

@Annosha

Description

@Annosha

What version of OpenTelemetry are you using?

"name": "opentelemetry-contrib",
"version": "0.1.0",
OS: Windows

What version of Node are you using?

v20.11.1

What did you do?

Cloned the repo to setup dev env for contribution
compiled the code without any warnings or errors.
compile

But running npm test on root level as well as on module level of mentioned modules give errors:
failed-test
Detailed log of errors for respective modules is attached below.
instrumentation-cucumber-test-log.txt
instrumentation-fs-test-log.txt

What did you expect to see?

The tests must be modified to handle platform-specific tests

What did you see instead?

Error due to platform-specific path mismatch. The test expects the root path 'C:\' on Windows to be loosely equal to '/', the root path on Unix-based systems. This causes an AssertionError as the file system paths differ between operating systems.
cucumber-test-error
fs-failed-test

Additional context

The test does not account for Windows-specific path formats, leading to the failure. We can:

  • Check the OS type using process.platform and adjusting the expected value accordingly.

  • Normalizing the paths to make them comparable across platforms.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions