summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-05-14 10:56:08 -0600
committermo khan <mo.khan@gmail.com>2020-05-15 09:35:22 -0600
commitecc480c86f8bec8f1b9e58b7caefddedaf8dde12 (patch)
tree38915817913a301b0675ff72385a50a7e7430043 /spec
parentf91ef2e9f1ac7c2a1fc2e71423b0f09ba89a63cd (diff)
Pull yarn packages from a custom registry
Diffstat (limited to 'spec')
-rw-r--r--spec/integration/js/yarn_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/integration/js/yarn_spec.rb b/spec/integration/js/yarn_spec.rb
index 47d340d..1e0eb52 100644
--- a/spec/integration/js/yarn_spec.rb
+++ b/spec/integration/js/yarn_spec.rb
@@ -149,4 +149,41 @@ RSpec.describe "yarn" do
end
end
end
+
+ context "when scanning a project with dependencies sourced from a custom registry" do
+ subject { runner.scan(env: { 'ADDITIONAL_CA_CERT_BUNDLE' => fixture_file_content('js/custom-npm.crt') }) }
+
+ before do
+ runner.add_file(".yarnrc.yml", "npmRegistryServer: \"https://#{private_npm_host}\"")
+
+ runner.add_file("package.json") do
+ JSON.pretty_generate({
+ name: "js-yarn",
+ version: "1.0.0",
+ description: "Test project for js-yarn",
+ dependencies: {
+ lodash: "4.17.10"
+ },
+ devDependencies: {},
+ scripts: { test: "echo 'test'" }
+ })
+ end
+ runner.add_file("yarn.lock") do
+ <<-SCRIPT
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+lodash@4.17.10:
+ version "4.17.10"
+ resolved "https://#{private_npm_host}/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
+ integrity sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==
+ SCRIPT
+ end
+ end
+
+ specify { expect(subject).to match_schema(version: '2.0') }
+ specify { expect(subject.dependency_names).to match_array(%w[lodash]) }
+ specify { expect(subject.licenses_for('lodash')).to match_array(['MIT']) }
+ end
end