Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm: Convert UpdateChecker specs to projects #3156

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
[{
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "etag",
"description": "Create simple ETags",
"version": "1.8.0",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>",
"David Björklund <david.bjorklund@gmail.com>"
],
"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/"
}
}
Original file line number Diff line number Diff line change
@@ -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"
}
}