Platform-Specific Path Assertion Error: Windows vs. Unix Root Path Mismatch in Tests #2490
Labels
bug
Something isn't working
internal
pkg:instrumentation-cucumber
pkg:instrumentation-fs
priority:p4
Bugs and spec inconsistencies which do not fall into a higher prioritization
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.
But running
npm test
on root level as well as on module level of mentioned modules give errors: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.
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.
The text was updated successfully, but these errors were encountered: