summaryrefslogtreecommitdiff
path: root/spec/integration/js/bower_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration/js/bower_spec.rb')
-rw-r--r--spec/integration/js/bower_spec.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/spec/integration/js/bower_spec.rb b/spec/integration/js/bower_spec.rb
new file mode 100644
index 0000000..2127c2e
--- /dev/null
+++ b/spec/integration/js/bower_spec.rb
@@ -0,0 +1,64 @@
+require 'spec_helper'
+
+RSpec.describe "bower" do
+ context "when scanning a simple bower project" do
+ subject { runner.scan }
+
+ before do
+ runner.add_file('bower.json', fixture_file_content('js/bower/bower.json'))
+ end
+
+ specify { expect(subject).to match_schema(version: '2.0') }
+ 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']) }
+ specify { expect(subject.licenses_for('masonry-layout')).to match_array(['MIT']) }
+ specify { expect(subject.licenses_for('matches-selector')).to match_array(['MIT']) }
+ 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
+
+ [
+ 'https://gitlab.com/gitlab-org/ci-training-slides',
+ 'https://gitlab.com/gitlab-org/frontend/At.js.git',
+ 'https://gitlab.com/gitlab-org/gitter/gitter-marked.git'
+ ].each do |git_repo|
+ context "when scanning #{git_repo}" do
+ subject { runner.scan }
+
+ before do
+ runner.clone(git_repo)
+ end
+
+ specify { expect(subject).to match_schema(version: '2.0') }
+ specify { expect(subject.dependency_names).not_to be_empty }
+ end
+ end
+end