summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/java/gradle_spec.rb15
-rw-r--r--spec/integration/java/maven_spec.rb71
-rw-r--r--spec/integration/js/npm_spec.rb29
3 files changed, 106 insertions, 9 deletions
diff --git a/spec/integration/java/gradle_spec.rb b/spec/integration/java/gradle_spec.rb
index 108c915..852d19e 100644
--- a/spec/integration/java/gradle_spec.rb
+++ b/spec/integration/java/gradle_spec.rb
@@ -171,4 +171,19 @@ plugins {
end
end
end
+
+ context "when scanning gradle project in a sub directory" do
+ let(:env) do
+ {
+ 'LICENSE_FINDER_CLI_OPTS' => '--project-path=service/gradle-backend'
+ }
+ end
+
+ before do
+ runner.mount(dir: fixture_file('java/gradle/nested'))
+ end
+
+ specify { expect(subject).to match_schema }
+ specify { expect(subject.dependency_names).to match_array(["postgresql"]) }
+ end
end
diff --git a/spec/integration/java/maven_spec.rb b/spec/integration/java/maven_spec.rb
index 72fec6d..7d4896b 100644
--- a/spec/integration/java/maven_spec.rb
+++ b/spec/integration/java/maven_spec.rb
@@ -142,4 +142,75 @@ RSpec.describe "maven" do
end
end
end
+
+ context "when scanning maven project in a sub directory" do
+ let(:env) do
+ {
+ 'LICENSE_FINDER_CLI_OPTS' => '--project-path=service/maven-backend'
+ }
+ end
+
+ before do
+ runner.mount(dir: fixture_file('java/maven/nested'))
+ end
+
+ specify { expect(subject).to match_schema }
+
+ specify do
+ expect(subject.dependency_names).to match_array([
+ "accessors-smart",
+ "android-json",
+ "annotations",
+ "apiguardian-api",
+ "asm",
+ "assertj-core",
+ "byte-buddy",
+ "byte-buddy-agent",
+ "hamcrest",
+ "jakarta.activation-api",
+ "jakarta.annotation-api",
+ "jakarta.xml.bind-api",
+ "json-path",
+ "json-smart",
+ "jsonassert",
+ "jul-to-slf4j",
+ "junit-jupiter",
+ "junit-jupiter-api",
+ "junit-jupiter-engine",
+ "junit-jupiter-params",
+ "junit-platform-commons",
+ "junit-platform-engine",
+ "kotlin-reflect",
+ "kotlin-stdlib",
+ "kotlin-stdlib-common",
+ "kotlin-stdlib-jdk7",
+ "kotlin-stdlib-jdk8",
+ "log4j-api",
+ "log4j-to-slf4j",
+ "logback-classic",
+ "logback-core",
+ "mockito-core",
+ "mockito-junit-jupiter",
+ "objenesis",
+ "opentest4j",
+ "slf4j-api",
+ "snakeyaml",
+ "spring-aop",
+ "spring-beans",
+ "spring-boot",
+ "spring-boot-autoconfigure",
+ "spring-boot-starter",
+ "spring-boot-starter-logging",
+ "spring-boot-starter-test",
+ "spring-boot-test",
+ "spring-boot-test-autoconfigure",
+ "spring-context",
+ "spring-core",
+ "spring-expression",
+ "spring-jcl",
+ "spring-test",
+ "xmlunit-core"
+ ])
+ end
+ end
end
diff --git a/spec/integration/js/npm_spec.rb b/spec/integration/js/npm_spec.rb
index 69c806b..5084111 100644
--- a/spec/integration/js/npm_spec.rb
+++ b/spec/integration/js/npm_spec.rb
@@ -3,11 +3,13 @@
require 'spec_helper'
RSpec.describe "npm" do
+ subject { runner.scan(env: env) }
+
+ let(:env) { {} }
+
include_examples "each report version", "js", "npm", "e80dba9c"
context 'when scanning a project with no dependencies' do
- subject { runner.scan }
-
before do
runner.add_file('package.json') do
JSON.generate(name: "example", version: "1.0.0", license: "ISC")
@@ -22,8 +24,6 @@ RSpec.describe "npm" do
end
context 'when scanning a project with a single dependency and a `package-lock.json` file' do
- subject { runner.scan }
-
before do
runner.mount(dir: fixture_file('js/single-declared-dependency'))
end
@@ -169,8 +169,6 @@ RSpec.describe "npm" do
end
context 'when scanning a project without a `package-lock.json` file' do
- subject { runner.scan }
-
before do
runner.add_file('package.json', fixture_file_content('js/single-declared-dependency/package.json'))
end
@@ -316,8 +314,6 @@ RSpec.describe "npm" do
end
context "when scanning a project with an older engine" do
- subject { runner.scan }
-
before do
runner.add_file('package.json') do
JSON.generate(
@@ -470,7 +466,7 @@ RSpec.describe "npm" do
end
context "when scanning a project with dependencies sourced from a custom registry" do
- subject { runner.scan(env: { 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate.read }) }
+ let(:env) { { 'ADDITIONAL_CA_CERT_BUNDLE' => x509_certificate.read } }
let(:private_npm_host) { 'npm.test' }
@@ -508,4 +504,19 @@ RSpec.describe "npm" do
specify { expect(subject.licenses_for('js-npm')).to match_array(['MIT']) }
specify { expect(subject.licenses_for('lodash')).to match_array(['MIT']) }
end
+
+ context "when scanning project in a sub directory" do
+ let(:env) do
+ {
+ 'LICENSE_FINDER_CLI_OPTS' => '--project-path=service/frontend'
+ }
+ end
+
+ before do
+ runner.mount(dir: fixture_file('js/npm/nested'))
+ end
+
+ specify { expect(subject).to match_schema }
+ specify { expect(subject.dependency_names).to include("@angular/animations", "@angular/common", "@angular/compiler", "@angular/core", "@angular/forms") }
+ end
end