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

Aberta
#60,026 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

@lazerg já está trabalhando nisso.

Desde 16/11/2026.

  • #60032 de @lazerg — aberto

Avaliação

Dificuldade
1/5
Tempo estimado
Menos de uma hora
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
javascript, node.js, react-native
Domínio
mobile, testing

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
C++
Estrelas
127k
Forks
25.5k
Merge médio
3d 22h
PRs com merge (30d)
235

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de react/react-native

Todas as issues de react/react-native

Issues semelhantes

Mais issues de C++

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.