Repository navigation
test: assert every path the package manifest declares names a file - #1857
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
An export condition matches on key presence, not on whether its target resolves, so a target naming a missing file is ERR_MODULE_NOT_FOUND with no fallthrough to `import` or `require`. Every broken target in this manifest so far was found by a consumer rather than by CI — nativewind#1638 fixed `.` and `./babel`, nativewind#1723 fixed `./types`, 361e90b fixed `./metro`'s `source` — because the test suite, `tsc` and `eslint` never resolve the manifest. The test walks `main`, `module`, `types` and every leaf of the `exports` condition tree and asserts each one names a file that exists. Build-output targets are checked once `yarn build` has run; CI builds before it tests, and `prepublishOnly` builds before it publishes.
YevheniiKotyrlo
force-pushed
the
fix/metro-source-export-target
branch
from
October 11, 2026 15:27
d7d66b3 to
637375f
Compare
This branch has not been deployed
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.
Problem
An export condition matches on key presence, not on whether its target resolves, so a target naming a missing file fails with
ERR_MODULE_NOT_FOUNDinstead of falling through../metro'ssourcetarget named./src/metro.tsfor a module authored.tsxuntil 361e90b. It was the third broken target in this manifest after #1638 (.,./babel) and #1723 (./types), and consumers found all three.Why it isn't caught today
Jest,
tscandeslintnever resolve the manifest, and.github/scripts/consumer_rc.pyloadsnativewind/metroandnativewind/babelunder Node's default conditions, so nosourceortypestarget is ever resolved.Solution
361e90b fixed
./metro, so this PR now carries only the guard.src/__tests__/package-exports.tswalksmain,module,typesand every leaf of theexportscondition tree and asserts each names a file that exists. The list comes from the manifest, so a new export is covered as soon as it is added, and two cases assert the list is non-empty, so a manifest that stops being read fails instead of passing. Targets under bob'soutputdirectory are checked once a build has run, which CI does before testing andprepublishOnlybefore publishing.Tests
With
./metro'ssourceset back to./src/metro.ts, the guard fails on that one target and the other three cases pass:Verification
On Windows with Node 26:
yarn lintclean ·yarn typecheckclean ·yarn buildclean ·yarn test --maxWorkers=2 --coverage11 suites, 103 tests passed ·yarn example expo export --platform webclean · no unstaged files after either build · release guards 17 passed. Not run: the iOS dev build, which no file in this change reaches.Base
Cut from
f9cfae6c, the currentmain.