|
9 | 9 | dependency: dependency,
|
10 | 10 | credentials: credentials,
|
11 | 11 | npmrc_file: npmrc_file,
|
12 |
| - yarnrc_file: yarnrc_file |
| 12 | + yarnrc_file: yarnrc_file, |
| 13 | + yarnrc_yml_file: yarnrc_yml_file |
13 | 14 | )
|
14 | 15 | end
|
15 | 16 | let(:npmrc_file) { nil }
|
16 | 17 | let(:yarnrc_file) { nil }
|
| 18 | + let(:yarnrc_yml_file) { nil } |
17 | 19 | let(:credentials) do
|
18 | 20 | [{
|
19 | 21 | "type" => "git_source",
|
|
62 | 64 | it { is_expected.to eq("http://example.com") }
|
63 | 65 | end
|
64 | 66 |
|
| 67 | + context "with a global yarn berry registry" do |
| 68 | + let(:yarnrc_yml_file) do |
| 69 | + Dependabot::DependencyFile.new(name: ".yarnrc.yml", content: 'npmRegistryServer: "https://example.com"') |
| 70 | + end |
| 71 | + |
| 72 | + it { is_expected.to eq("https://example.com") } |
| 73 | + end |
| 74 | + |
65 | 75 | context "with a scoped npm registry" do
|
66 | 76 | let(:dependency_name) { "@dependabot/some_dep" }
|
67 | 77 | let(:npmrc_file) { Dependabot::DependencyFile.new(name: ".npmrc", content: "@dependabot:registry=http://example.com") }
|
|
82 | 92 |
|
83 | 93 | it { is_expected.to eq("http://example.com") }
|
84 | 94 | end
|
| 95 | + |
| 96 | + context "with a scoped yarn berry registry" do |
| 97 | + let(:dependency_name) { "@dependabot/some_dep" } |
| 98 | + let(:yarnrc_yml_content) do |
| 99 | + <<~YARNRC |
| 100 | + npmScopes: |
| 101 | + dependabot: |
| 102 | + npmRegistryServer: "https://example.com" |
| 103 | + YARNRC |
| 104 | + end |
| 105 | + let(:yarnrc_yml_file) { Dependabot::DependencyFile.new(name: ".yarnrc", content: yarnrc_yml_content) } |
| 106 | + |
| 107 | + it { is_expected.to eq("https://example.com") } |
| 108 | + end |
85 | 109 | end
|
86 | 110 |
|
87 | 111 | describe "registry" do
|
|
221 | 245 | end
|
222 | 246 | end
|
223 | 247 |
|
| 248 | + context "with a .yarnrc.yml file" do |
| 249 | + let(:yarnrc_yml_file) do |
| 250 | + project_dependency_files(project_name).find { |f| f.name == ".yarnrc.yml" } |
| 251 | + end |
| 252 | + let(:project_name) { "yarn_berry/yarnrc_global_registry" } |
| 253 | + |
| 254 | + before do |
| 255 | + url = "https://npm-proxy.fury.io/password/dependabot/etag" |
| 256 | + body = fixture("gemfury_responses", "gemfury_response_etag.json") |
| 257 | + |
| 258 | + stub_request(:get, url).to_return(status: 200, body: body) |
| 259 | + end |
| 260 | + |
| 261 | + it { is_expected.to eq("npm-proxy.fury.io/password/dependabot") } |
| 262 | + |
| 263 | + context "that can't be reached" do |
| 264 | + before do |
| 265 | + url = "https://npm-proxy.fury.io/password/dependabot/etag" |
| 266 | + stub_request(:get, url).to_return(status: 401, body: "") |
| 267 | + end |
| 268 | + |
| 269 | + # Since this registry is declared at the global registry, in the absence |
| 270 | + # of other information we should still us it (and *not* flaa back to |
| 271 | + # registry.npmjs.org) |
| 272 | + it { is_expected.to eq("npm-proxy.fury.io/password/dependabot") } |
| 273 | + end |
| 274 | + end |
| 275 | + |
224 | 276 | context "with a private registry source" do
|
225 | 277 | let(:source) do
|
226 | 278 | { type: "registry", url: "https://npm.fury.io/dependabot" }
|
|
0 commit comments