Repository navigation
Conversation
robhogan
force-pushed
the
pr1937
branch
2 times, most recently
from
September 17, 2026 11:47
a566848 to
7138ab8
Compare
robhogan
marked this pull request as ready for review
September 17, 2026 11:49
Contributor
|
@vzaidman has imported this pull request. If you are a Meta employee, you can view this in D120534260. |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved blocking issues are identified.
Review effort: Lite
Findings: None
What changed in this PR
Updates Metro’s Jest tests for Windows compatibility by removing POSIX-only assumptions and obsolete Windows skips.
Changes:
- Normalizes filesystem paths across affected test suites.
- Corrects platform-specific mocks and resolver traversal.
- Retains only documented Windows skips.
| File | Description |
|---|---|
scripts/jestFilter.js |
Updates the Windows skip list. |
packages/metro/src/Server/__tests__/Server-test.js |
Normalizes filesystem paths. |
packages/metro/src/node-haste/lib/__tests__/AssetPaths-test.js |
Uses native path inputs. |
packages/metro/src/DeltaBundler/Serializers/helpers/__tests__/js-test.js |
Makes module paths portable. |
packages/metro/src/DeltaBundler/__tests__/resolver-test.js |
Uses POSIX path mocks. |
packages/metro/src/DeltaBundler/__tests__/Graph-test.js |
Normalizes graph paths. |
packages/metro/src/DeltaBundler/__tests__/DeltaCalculator-test.js |
Corrects POSIX mock behavior. |
packages/metro/src/DeltaBundler/__tests__/buildSubgraph-test.js |
Normalizes subgraph paths. |
packages/metro/src/__tests__/HmrServer-test.js |
Normalizes module paths. |
packages/metro/src/__tests__/Assets-test.js |
Uses platform-aware filesystem paths. |
packages/metro-transform-worker/src/__tests__/index-test.js |
Removes incompatible transformer filesystem setup. |
packages/metro-symbolicate/src/__tests__/symbolicate-test.js |
Normalizes absolute-path snapshots. |
packages/metro-resolver/src/__tests__/utils.js |
Fixes Windows package traversal. |
packages/metro-resolver/src/__tests__/symlinks-test.js |
Normalizes symlink paths. |
packages/metro-resolver/src/__tests__/platform-extensions-test.js |
Normalizes resolver paths. |
packages/metro-resolver/src/__tests__/package-exports-test.js |
Makes export tests portable. |
packages/metro-resolver/src/__tests__/index-test.js |
Makes resolver expectations portable. |
packages/metro-resolver/src/__tests__/browser-spec-test.js |
Normalizes browser resolution paths. |
packages/metro-resolver/src/__tests__/assets-test.js |
Normalizes asset paths. |
packages/metro-resolver/src/__tests__/__snapshots__/index-test.js.snap |
Removes the replaced path-dependent snapshot. |
packages/metro-file-map/src/crawlers/__tests__/node-test.js |
Tests both path platforms. |
packages/metro-file-map/src/__tests__/index-test.js |
Normalizes file-map paths and messages. |
packages/buck-worker-tool/src/__tests__/worker-test.js |
Uses POSIX paths for the mocked filesystem. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
vzaidman
approved these changes
Sep 28, 2026
Collaborator
Author
|
@vzaidman - thanks for the stamp but since it's been imported I can't merge it from here - D120534260 needs to land. |
Contributor
|
I'll land it |
Contributor
|
@robhogan please rebase and land it. I unlinked it from the imported PR. |
robhogan
force-pushed
the
pr1937
branch
2 times, most recently
from
September 29, 2026 16:04
5c51121 to
2d1913b
Compare
Summary:
`scripts/jestFilter.js` skipped 30 test suites on Windows. Most were failing because of posix assumptions in the tests themselves, not Metro. This fixes those tests and removes them from the skip list, so they run in Windows CI.
The fixes remove posix assumptions without weakening what's asserted:
- Filesystem paths in inputs and expectations are written as posix and made portable with the existing `p()` helpers (`posixToSystemPath`, `createPathNormalizer`), so tests use realistic `C:\...` paths on Windows.
- Client-facing values - URLs, `httpServerLocation`, `sourceURL`s, specifiers, package.json keys - stay asserted with forward slashes on every platform.
- Suites parameterised over `posix`/`win32` now mock `node:path` with `path.posix` for the posix half, rather than the host's `path`, which on Windows is `path.win32`.
- `metro-resolver`'s `getPackageForModule` test helper looped forever on Windows (`path.win32.parse('/root').root` is `/` but `dirname` returns `\`), hanging three suites.
- Some inline and file snapshots embedding absolute paths are replaced by exact assertions built with `p()`.
Still skipped on Windows:
- `api-snapshots-sync-test.js` - `flow-api-translator` emits `os.EOL` line endings in generated comments. API snapshots are only meaningfully generated on posix.
- `js-test.js` and `symbolicate-test.js` - these expose real Windows bugs, fixed and unskipped in the next commits in this stack.
Changelog: [Internal]
Test Plan:
Windows CI on this PR: all suites pass except the three still skipped, whose failures on Windows are exactly the product bugs described above.
```
yarn jest
Test Suites: 148 passed, 148 total
yarn flow check
yarn lint
```
robhogan
added a commit
that referenced
this pull request
Sep 29, 2026
#1937 runs Server-test and the metro-transform-worker tests on Windows against a platform-aware `metro-memory-fs`, so the asset URL tests added here, written against POSIX paths, failed there after merging main. They now build their paths with `posixToSystemPath`, as the rest of those files do, and the metro-transform-worker test gets the same platform-aware in-memory filesystem as `Assets-test`. `metro-resolver` becomes a devDependency of `metro-transform-worker` for the helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scripts/jestFilter.jsskipped 25 test suites on Windows. Most of them failed because of posix assumptions in the tests rather than in Metro, so this fixes the tests and removes them from the skip list to run in Windows CI.The tests still assert the same things, but filesystem paths are written as posix and passed through the existing
p()helpers (posixToSystemPath,createPathNormalizer), so on Windows they're realisticC:\...paths. Client-facing values - URLs,httpServerLocation,sourceURLs, specifiers,package.jsonkeys - are still asserted with forward slashes on every platform.Suites parameterised over
posixandwin32now mocknode:pathwithpath.posixfor the posix half, rather than the host'spath(which ispath.win32on Windows).metro-resolver'sgetPackageForModuletest helper also looped forever on Windows and hung three suites, becausepath.win32.parse('/root').rootis/butdirnamereturns\.Still skipped on Windows:
api-snapshots-sync-test.js-flow-api-translatoremitsos.EOLline endings in generated comments, and API snapshots are only meaningfully generated on posix.js-test.jsandsymbolicate-test.js, which expose real Windows bugs. Fix backslashes in async bundle paths on Windows #1938 and Fix symbolication of stack traces with Windows absolute paths #1939 fix and unskip them.Changelog: Internal
Test plan:
Windows CI on this PR - every suite passes except the three still skipped, whose Windows failures are exactly the bugs above.