Skip to content

Commit d6d6863

Browse files
Fix: Make screenshotUtils-test.js pass on Windows
Normalize paths to forward slashes before checking for snapshot directory in the expected path, since path.join uses backslashes on Windows. Fixes #60026
1 parent 076d7f5 commit d6d6863

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎private/react-native-fantom/runner/screenshots/__tests__/screenshotUtils-test.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ it('continues generating differences after missing, corrupt or unwritable files'
184184
it('creates new images next to Jest snapshots', () => {
185185
const result = createResult(true, false);
186186
processScreenshotResults(getConfig(), [result], 'new', passedTests);
187-
expect(result.expectedPath).toContain(
188-
'__snapshots__/example-test.js.screenshots/',
189-
);
187+
// Normalize paths to work on Windows (path.join uses \ on Windows)
188+
const expectedPath = result.expectedPath.replace(/\\/g, '/');
189+
expect(expectedPath).toContain('__snapshots__/example-test.js.screenshots/');
190190
expect(fs.readFileSync(result.expectedPath, 'utf8')).toBe('new image');
191191
expect(
192192
result.receivedPath == null || !fs.existsSync(result.receivedPath),

0 commit comments

Comments
 (0)