diff --git a/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker_spec.rb b/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker_spec.rb index 28282c85f7..470551ae74 100644 --- a/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker_spec.rb +++ b/npm_and_yarn/spec/dependabot/npm_and_yarn/update_checker_spec.rb @@ -34,14 +34,7 @@ end let(:ignored_versions) { [] } let(:security_advisories) { [] } - let(:dependency_files) { [package_json] } - let(:package_json) do - Dependabot::DependencyFile.new( - name: "package.json", - content: fixture("package_files", manifest_fixture_name) - ) - end - let(:manifest_fixture_name) { "package.json" } + let(:dependency_files) { project_dependency_files("npm6/no_lockfile") } let(:credentials) do [{ @@ -67,7 +60,7 @@ describe "#up_to_date?", :vcr do context "with no lockfile" do - let(:manifest_fixture_name) { "peer_dependency_typescript.json" } + let(:dependency_files) { project_dependency_files("npm6/peer_dependency_typescript_no_lockfile") } let(:dependency) do Dependabot::Dependency.new( name: "typescript", @@ -188,6 +181,7 @@ end describe "#latest_version" do + let(:dependency_files) { project_dependency_files("npm6/no_lockfile") } subject { checker.latest_version } it "delegates to LatestVersionFinder" do @@ -519,6 +513,7 @@ subject { checker.latest_resolvable_version_with_no_unlock } context "with a non-git dependency" do + let(:dependency_files) { project_dependency_files("npm6/no_lockfile") } let(:dependency) do Dependabot::Dependency.new( name: "etag", @@ -661,6 +656,7 @@ end describe "#latest_resolvable_previous_version" do + let(:dependency_files) { project_dependency_files("npm6/no_lockfile") } let(:updated_version) { Gem::Version.new("1.7.0") } subject(:latest_resolvable_previous_version) do checker.latest_resolvable_previous_version(updated_version) @@ -803,7 +799,7 @@ context "with a library (that has a lockfile)" do # We've already stubbed hitting the registry for etag (since it's also # the dependency we're checking in this spec) - let(:manifest_fixture_name) { "etag.json" } + let(:dependency_files) { project_dependency_files("npm6/etag_no_lockfile") } it "delegates to the RequirementsUpdater" do expect(described_class::RequirementsUpdater). @@ -990,7 +986,7 @@ end context "updating a deprecated dependency with a peer requirement" do - let(:manifest_fixture_name) { "peer_dependency.json" } + let(:dependency_files) { project_dependency_files("npm6/peer_dependency_no_lockfile") } let(:registry_listing_url) { "https://registry.npmjs.org/react-dom" } let(:registry_response) do fixture("npm_responses", "peer_dependency_deprecated.json") @@ -1038,6 +1034,7 @@ end context "#updated_dependencies_after_full_unlock" do + let(:dependency_files) { project_dependency_files("npm6/no_lockfile") } let(:dependency) do Dependabot::Dependency.new( name: "etag", diff --git a/npm_and_yarn/spec/fixtures/projects/npm6/etag_no_lockfile/package.json b/npm_and_yarn/spec/fixtures/projects/npm6/etag_no_lockfile/package.json new file mode 100644 index 0000000000..3b3156d94a --- /dev/null +++ b/npm_and_yarn/spec/fixtures/projects/npm6/etag_no_lockfile/package.json @@ -0,0 +1,44 @@ +{ + "name": "etag", + "description": "Create simple ETags", + "version": "1.8.0", + "contributors": [ + "Douglas Christopher Wilson ", + "David Björklund " + ], + "license": "MIT", + "keywords": [ + "etag", + "http", + "res" + ], + "repository": "jshttp/etag", + "devDependencies": { + "beautify-benchmark": "0.2.4", + "benchmark": "2.1.3", + "eslint": "3.15.0", + "eslint-config-standard": "6.2.1", + "eslint-plugin-markdown": "1.0.0-beta.3", + "eslint-plugin-promise": "3.4.2", + "eslint-plugin-standard": "2.0.1", + "istanbul": "0.4.5", + "mocha": "1.21.5", + "seedrandom": "2.4.2" + }, + "files": [ + "LICENSE", + "HISTORY.md", + "README.md", + "index.js" + ], + "engines": { + "node": ">= 0.6" + }, + "scripts": { + "bench": "node benchmark/index.js", + "lint": "eslint --plugin markdown --ext js,md .", + "test": "mocha --reporter spec --bail --check-leaks test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" + } +} diff --git a/npm_and_yarn/spec/fixtures/projects/npm6/peer_dependency_typescript_no_lockfile/package.json b/npm_and_yarn/spec/fixtures/projects/npm6/peer_dependency_typescript_no_lockfile/package.json new file mode 100644 index 0000000000..67ba45d345 --- /dev/null +++ b/npm_and_yarn/spec/fixtures/projects/npm6/peer_dependency_typescript_no_lockfile/package.json @@ -0,0 +1,23 @@ +{ + "name": "test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/waltfy/PROTO_TEST.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/waltfy/PROTO_TEST/issues" + }, + "homepage": "https://github.com/waltfy/PROTO_TEST#readme", + "dependencies": { + "@angular/compiler-cli": "^9.0.0", + "typescript": "3.7" + } +}