summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-05-19 14:31:31 -0600
committermo khan <mo.khan@gmail.com>2020-05-19 14:31:31 -0600
commit92e06d9fc1303b790398362b9a039e8bba58cd4e (patch)
tree4fcb063c095f5c898318efdbfa3a52e05e5726bd /spec
parente2a538ed5c817c792299750ae24c7569b68cd9f3 (diff)
Fetch bower dependencies from custom repo with custom cert chain
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/js/bower/bower.json4
-rw-r--r--spec/integration/js/bower_spec.rb26
2 files changed, 27 insertions, 3 deletions
diff --git a/spec/fixtures/js/bower/bower.json b/spec/fixtures/js/bower/bower.json
index 4cfbefc..f2760e7 100644
--- a/spec/fixtures/js/bower/bower.json
+++ b/spec/fixtures/js/bower/bower.json
@@ -1,6 +1,6 @@
{
- "name": "bower",
- "license": "MIT",
+ "name": "example-project",
+ "license": "ISC",
"private": true,
"ignore": [
"**/.*",
diff --git a/spec/integration/js/bower_spec.rb b/spec/integration/js/bower_spec.rb
index 1f97645..25a45cb 100644
--- a/spec/integration/js/bower_spec.rb
+++ b/spec/integration/js/bower_spec.rb
@@ -9,9 +9,10 @@ RSpec.describe "bower" do
end
specify { expect(subject).to match_schema(version: '2.0') }
- specify { expect(subject.dependency_names).to match_array(['cli', 'ev-emitter', 'fizzy-ui-utils', 'get-size', 'jquery', 'masonry-layout', 'matches-selector', 'outlayer', 'stimulus.umd']) }
+ specify { expect(subject.dependency_names).to match_array(['cli', 'ev-emitter', 'example-project', 'fizzy-ui-utils', 'get-size', 'jquery', 'masonry-layout', 'matches-selector', 'outlayer', 'stimulus.umd']) }
specify { expect(subject.licenses_for('cli')).to match_array(['Apache-2.0', 'BSD-3-Clause', 'ISC', 'MIT']) }
specify { expect(subject.licenses_for('ev-emitter')).to match_array(['MIT']) }
+ specify { expect(subject.licenses_for('example-project')).to match_array(['ISC']) }
specify { expect(subject.licenses_for('fizzy-ui-utils')).to match_array(['MIT']) }
specify { expect(subject.licenses_for('get-size')).to match_array(['MIT']) }
specify { expect(subject.licenses_for('jquery')).to match_array(['MIT']) }
@@ -20,4 +21,27 @@ RSpec.describe "bower" do
specify { expect(subject.licenses_for('outlayer')).to match_array(['MIT']) }
specify { expect(subject.licenses_for('stimulus.umd')).to match_array(['unknown']) }
end
+
+ context "when scanning a bower project with a dependency 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(".npmrc", "registry = https://#{private_npm_host}")
+ runner.add_file(".bowerrc") do
+ JSON.pretty_generate({ resolvers: ['bower-npm-resolver'] })
+ end
+ runner.add_file("bower.json") do
+ JSON.pretty_generate({
+ name: "js-bower",
+ license: "ISC",
+ dependencies: { lodash: "npm:lodash#4.17.10" }
+ })
+ end
+ end
+
+ specify { expect(subject).to match_schema(version: '2.0') }
+ specify { expect(subject.dependency_names).to match_array(%w[js-bower lodash]) }
+ specify { expect(subject.licenses_for('js-bower')).to match_array(['ISC']) }
+ specify { expect(subject.licenses_for('lodash')).to match_array(['MIT']) }
+ end
end