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

Ouverte
#60,026 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@lazerg y travaille déjà.

Depuis le 16/11/2026.

  • #60032 par @lazerg — ouverte

Évaluation

Difficulté
1/5
Temps estimé
Moins d'une heure
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
javascript, node.js, react-native
Domaine
mobile, testing

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
C++
Étoiles
127k
Forks
25.5k
Merge moyen
3 j 22 h
PR mergées (30 j)
235

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de react/react-native

Toutes les issues de react/react-native

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.