Skip to content

Commit

Permalink
fix(check-update): fixed output for current major
Browse files Browse the repository at this point in the history
- don't output the latest minor in current major if we're already on the latest major
  • Loading branch information
ErisDS committed May 20, 2022
1 parent 5b83003 commit b72c25b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/commands/check-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CheckUpdateCommand extends Command {

this.ui.log(`Current version: ${chalk.cyan(instance.version)}`);

if (latestMinor && semver.gt(latestMinor, instance.version)) {
if (latestMinor && semver.neq(latestMinor, instance.version) && semver.neq(latestMinor, latest)) {
this.ui.log(`Latest ${currentMajor}.x version: ${chalk.cyan(latestMinor)}`);
}

Expand Down
4 changes: 2 additions & 2 deletions test/unit/commands/check-update-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Unit: Commands > check-update', function () {
});

it('logs out available new version', async function () {
const loadVersions = sinon.stub().resolves({latest: '2.1.0', latestMajor: {v1: '1.0.0'}});
const loadVersions = sinon.stub().resolves({latest: '2.1.0', latestMajor: {v1: '1.0.0', v2: '2.1.0'}});
const CheckUpdateCommand = proxyquire(modulePath, {
'../utils/version': {loadVersions}
});
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Unit: Commands > check-update', function () {
});

it('logs out available new major version when on latest minor', async function () {
const loadVersions = sinon.stub().resolves({latest: '4.1.0', latestMajor: {v1: '1.0.0', v2: '2.0.0', v3: '3.42.0'}});
const loadVersions = sinon.stub().resolves({latest: '4.1.0', latestMajor: {v1: '1.0.0', v2: '2.0.0', v3: '3.42.0', v4: '4.1.0'}});
const CheckUpdateCommand = proxyquire(modulePath, {
'../utils/version': {loadVersions}
});
Expand Down

0 comments on commit b72c25b

Please sign in to comment.