-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from planningcenter/km/fix/yarn-3-deploying
fix: improve reliability of version comparisons
- Loading branch information
Showing
6 changed files
with
992 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
describe Deployer::Repo::VersionCompare do | ||
describe "#major_upgrade?" do | ||
it "works when detecting a yarn 3 file" do | ||
version_compare = | ||
described_class.new( | ||
package_name: "@planningcenter/tapestry-react", | ||
version: "4.6.0", | ||
yarn_lock_file_path: "spec/fixtures/yarn3.lock" | ||
) | ||
|
||
expect(version_compare.major_upgrade?).to eq(false) | ||
end | ||
|
||
it "works when detecting a yarn file" do | ||
version_compare = | ||
described_class.new( | ||
package_name: "@planningcenter/tapestry-react", | ||
version: "4.6.0", | ||
yarn_lock_file_path: "spec/fixtures/yarn.lock" | ||
) | ||
|
||
expect(version_compare.major_upgrade?).to eq(false) | ||
end | ||
|
||
it "raises error when lock file does not contain the dependency" do | ||
version_compare = | ||
described_class.new( | ||
package_name: "@planningcenter/tapestry-react", | ||
version: "4.6.0", | ||
yarn_lock_file_path: "spec/fixtures/empty_lock.lock" | ||
) | ||
|
||
expect { version_compare.major_upgrade? }.to raise_error( | ||
Deployer::VersionCompareFailure, | ||
"[Deployer::VersionCompareFailure]: Could not find @planningcenter/tapestry-react in yarn.lock" | ||
) | ||
end | ||
|
||
context "when there is no lock file" do | ||
it "raises error" do | ||
version_compare = | ||
described_class.new( | ||
package_name: "@planningcenter/tapestry-react", | ||
version: "4.6.0", | ||
yarn_lock_file_path: "spec/fixtures/missing.lock" | ||
) | ||
|
||
expect { version_compare.major_upgrade? }.to raise_error( | ||
Deployer::VersionCompareFailure, | ||
"[Deployer::VersionCompareFailure]: No yarn.lock file found" | ||
) | ||
end | ||
end | ||
end | ||
end |
Empty file.
Oops, something went wrong.