forked from yarnpkg/yarn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-resolver.js
64 lines (55 loc) 路 2.4 KB
/
package-resolver.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* @flow */
/* eslint max-len: 0 */
import * as reporters from '../src/reporters/index.js';
import PackageResolver from '../src/package-resolver.js';
import * as constants from '../src/constants.js';
import Lockfile from '../src/lockfile/wrapper.js';
import Config from '../src/config.js';
import makeTemp from './_temp.js';
import * as fs from '../src/util/fs.js';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
const path = require('path');
const isCI = require('is-ci');
function addTest(pattern, registry = 'npm') {
// TODO renable these test.concurrent
xit(`resolve ${pattern}`, async () => {
const lockfile = new Lockfile();
const reporter = new reporters.NoopReporter({});
const loc = await makeTemp();
await fs.mkdirp(path.join(loc, 'node_modules'));
await fs.mkdirp(path.join(loc, constants.MODULE_CACHE_DIRECTORY));
const config = new Config(reporter);
await config.init({
cwd: loc,
cacheFolder: loc,
tempFolder: loc,
});
const resolver = new PackageResolver(config, lockfile);
await resolver.init([{pattern, registry}]);
await reporter.close();
});
}
// Public deps
addTest('https://github.com/npm-ml/re'); // git url with no .git
addTest('https://bitbucket.org/hgarcia/node-bitbucket-api.git'); // hosted git url
addTest('https://github.com/PolymerElements/font-roboto/archive/2fd5c7bd715a24fb5b250298a140a3ba1b71fe46.tar.gz'); // tarball
addTest('https://github.com/npm-ml/ocaml.git#npm-4.02.3'); // hash
addTest('https://git@github.com/babel/babylon.git'); // git url, with username
addTest('https://github.com/babel/babel-loader.git#feature/sourcemaps'); // hash with slashes
addTest('git+https://github.com/npm-ml/ocaml.git#npm-4.02.3'); // git+hash
addTest('gitlab:leanlabsio/kanban'); // gitlab
addTest('gist:d59975ac23e26ad4e25b'); // gist url
addTest('bitbucket:hgarcia/node-bitbucket-api'); // bitbucket url
addTest('scrollin'); // npm
addTest('gulp'); // npm
addTest('react-native'); // npm
addTest('ember-cli'); // npm
addTest('npm:gulp'); // npm
addTest('@polymer/iron-icon'); // npm scoped package
// Private deps
// Only the yarn CI tools have access to this private deps. If you want to test this locally,
// remove the if condition and change the urls to match your private deps.
if (isCI) {
addTest('yarnpkg/private-dep#c6cf811'); // private github shortcut
addTest('github:yarnpkg/private-dep#c6cf811'); // private github shortcut, with provider
}