Fantom's screenshotUtils-test.js fails on Windows: a test expects `/` in a path built with path.join

Aperta
#60,026 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@lazerg ci sta già lavorando.

Dal 16/11/2026.

  • #60032 di @lazerg — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript, node.js, react-native
Ambito
mobile, testing

Direzione di ricerca

Read private/react-native-fantom/runner/screenshots/__tests__/screenshotUtils-test.js, especially the “creates new images next to Jest snapshots” test around lines 184–189. Run the reported Jest command on Windows to confirm the path separator failure; compare its assertion with the earlier path.join assertion. Done when the test passes on Windows and still checks that the image path is beside the test file. An open linked pull request is already addressing this issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Needs: Triage :mag:
Description

private/react-native-fantom/runner/screenshots/__tests__/screenshotUtils-test.js's test "creates new images next to Jest snapshots" checks result.expectedPath with toContain('__snapshots__/example-test.js.screenshots/') (L184-L189). That path is built with path.join, which joins with \ on Windows, so the test fails there. The test before it compares with path.join(directory, 'actual.diff.png') (L170-L172). The assertion came with https://github.com/react/react-native/pull/59483.

Steps to reproduce
  1. On Windows, in a checkout of main (7a5d4ded60b) after yarn install, run yarn jest private/react-native-fantom/runner/screenshots/__tests__/screenshotUtils-test.js -t "creates new images next to Jest snapshots"; or run node repro.cjs <path to the checkout> from the reproducer below, which runs that one test and exits 1 while it fails.

Expected: the test passes on Windows, still checking that the new image is written under __snapshots__/example-test.js.screenshots/ beside the test file.
Actual: expect(received).toContain(expected) fails: the received path is C:\\Users\\…\\AppData\\Local\\Temp\\fantom-screenshot-test-VBIJPX\\__snapshots__\\example-test.js.screenshots\\image.png.

React Native Version

main at 7a5d4ded60b (nightly)

Affected Platforms

Build - Windows

Output of npx @react-native-community/cli info
Not applicable: this is a test in React Native's own repository. The reproducer's run:
react-native 7a5d4ded60b (2026-11-16), Windows_NT 10.0.26300, node v26.12.1, path.sep "\\"
Stacktrace or Logs
react-native 7a5d4ded60b (2026-11-16), Windows_NT 10.0.26300, node v26.12.1, path.sep "\\"
test file: private/react-native-fantom/runner/screenshots/__tests__/screenshotUtils-test.js
$ yarn jest private/react-native-fantom/runner/screenshots/__tests__/screenshotUtils-test.js -t "creates new images next to Jest snapshots"
jest exited 1
"creates new images next to Jest snapshots": failed
  Error: expect(received).toContain(expected) // indexOf
  Expected substring: "__snapshots__/example-test.js.screenshots/"
  Received string:    "C:\\Users\\…\\AppData\\Local\\Temp\\fantom-screenshot-test-VBIJPX\\__snapshots__\\example-test.js.screenshots\\image.png"
  at Object.toContain (private\react-native-fantom\runner\screenshots\__tests__\screenshotUtils-test.js:187:31)
SUMMARY: "creates new images next to Jest snapshots" fails on Windows: expectedPath, built with path.join, is C:\Users\…\AppData\Local\Temp\fantom-screenshot-test-VBIJPX\__snapshots__\example-test.js.screenshots\image.png, which does not contain "__snapshots__/example-test.js.screenshots/"
MANDATORY Reproducer

https://gist.github.com/YevheniiKotyrlo/38bf06d3101dd5ee6f3208fd5afc7824 — node repro.cjs <path to a react-native checkout> exits 1 while the test fails and 0 once it passes.

Screenshots and Videos

No response

Lingua principale
C++
Stelle
127k
Fork
25.5k
Merge medio
3g 22h
PR unite (30g)
235

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di react/react-native

Tutte le issue di react/react-native

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.