This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
Make .allDependencyTypings() respect path mappings #779
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.
If package A has a test dependency on B (because A's tests import B) and A has a path mapping B -> B/v#, then the compiler will use older-version B/v#, but
AllPackages.allDependencyTypings()
currently returns only the latest-versions of test dependencies:types-publisher/src/lib/packages.ts
Lines 124 to 127 in 54bd71c
This comes up in
check-parse-results.ts
checkPathMappings()
, which checks for unused path mappings: All of a package's path mappings must be accounted for by a transitive dependency.If A has a test dependency on B and a path mapping B -> B/v#, and B/v# in turn depends on C/v#, then A needs path mapping C -> C/v# or A's tests will combine possibly-incompatible packages B/v# and C-latest. But the compiler and
checkPathMappings()
currently use different versions of B: Unless B-latest also depends on C/v#,checkPathMappings()
will complain that A's C -> C/v# path mapping is unused. Then A can't get past the CI automation: Its tests fail without the path mapping andcheckPathMappings()
fails with it.checkPathMappings()
already handles the case that A has a regular dependency on B. It respects the path mapping and uses the older version B/v#, same as the compiler. This is implemented indefinition-parser.ts
calculateDependencies()
:types-publisher/src/lib/definition-parser.ts
Line 376 in 54bd71c
This PR applies the same logic to
AllPackages.allDependencyTypings()
and test dependencies.