This repository was archived by the owner on Jun 11, 2020. It is now read-only.
Make .allDependencyTypings() respect path mappings#779
Open
jablko wants to merge 1 commit intomicrosoft:masterfrom
Open
Make .allDependencyTypings() respect path mappings#779jablko wants to merge 1 commit intomicrosoft:masterfrom
jablko wants to merge 1 commit intomicrosoft:masterfrom
Conversation
sandersn
suggested changes
Jun 5, 2020
Member
sandersn
left a comment
There was a problem hiding this comment.
This is a great fix. I've noticed this before and was very puzzled.
I have the same request as your other PR to move this fix and add a test by adding to createMockDT.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.tscheckPathMappings(), 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.tscalculateDependencies():types-publisher/src/lib/definition-parser.ts
Line 376 in 54bd71c
This PR applies the same logic to
AllPackages.allDependencyTypings()and test dependencies.