-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix support for private git repos when using shorted repo syntax and …
…lock file exists Force git remote type if the resolved url it's a git private url.
- Loading branch information
1 parent
25890c8
commit 3977ebd
Showing
2 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* @flow */ | ||
|
||
import PackageRequest from '../src/package-request.js'; | ||
import Lockfile from '../src/lockfile/wrapper.js'; | ||
|
||
test('Produce valid remote type for a git private dep', () => { | ||
const pattern = 'private-dep@github:yarnpkg/private-dep#1.0.0'; | ||
const privateDepCache = { | ||
[pattern]: { | ||
version: '1.0.0', | ||
resolved: 'git+ssh://git@github.com/yarnpkg/private-dep.git#d6c57894210c52be02da7859dbb5205feb85d8b0', | ||
}, | ||
}; | ||
const lockfile = new Lockfile(privateDepCache); | ||
const request = new PackageRequest({pattern}, {lockfile, usedRegistries: {add: () => {}}}); | ||
|
||
expect(request.getLocked('git')._remote.type).toBe('git'); | ||
expect(request.getLocked('tarball')._remote.type).toBe('git'); | ||
}); | ||
|
||
test('Produce valid remote type for a git public dep', () => { | ||
const pattern = 'private-dep@yarnpkg/private-dep#1fde368'; | ||
const privateDepCache = { | ||
[pattern]: { | ||
version: '1.0.0', | ||
resolved: 'https://codeload.github.com/yarnpkg/public-dep/tar.gz/1fde368', | ||
}, | ||
}; | ||
const lockfile = new Lockfile(privateDepCache); | ||
const request = new PackageRequest({pattern}, {lockfile, usedRegistries: {add: () => {}}}); | ||
|
||
expect(request.getLocked('git')._remote.type).toBe('git'); | ||
expect(request.getLocked('tarball')._remote.type).toBe('tarball'); | ||
}); |
This file contains 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