Skip to content

On a Windows host, a test's file name reaches the device with backslashes #216

Closed

Description

@YevheniiKotyrlo

Describe the bug

Run from a Windows host, context.task.file.name is src\__tests__\normal\smoke.harness.ts instead of src/__tests__/normal/smoke.harness.ts, so the playground's smoke.harness.ts fails:

expected 'src\__tests__\normal\smoke.harness.ts' to be 'src/__tests__/normal/smoke.harness.ts' // Object.is equality

The Jest runner names a test file with path.relative(rootDir, testPath) (packages/jest/src/run.ts, execute-run.ts), which uses the host's separator. The same name goes to the device as the module Metro bundles, with the setup files, and to the file hooks and diagnostics.

I have a fix that converts those names to forward slashes. I can open a PR.

System Info

System:
  OS: Windows 11 10.0.26200
Binaries:
  Node: 26.8.1
Device: Android emulator, API 35, x86_64

React Native Harness Version

1.6.0 (main at bca0781)

Reproduction

https://github.com/callstackincubator/react-native-harness/blob/main/apps/playground/src/__tests__/normal/smoke.harness.ts

Steps to reproduce

  1. On Windows, run react-native-harness --harnessRunner android src/__tests__/normal/smoke.harness.ts in apps/playground.
  2. "Smoke test › should expose task context to tests" fails on the file name above.

Activity

  1. added a commit that references this issue on Oct 25, 2026
    b0e4eda
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions