Skip to content

Commit

Permalink
Merge pull request #289 from happo/fix-version-error
Browse files Browse the repository at this point in the history
Fix invalid version command in happo-ci
  • Loading branch information
trotzig authored Jul 1, 2024
2 parents fcec093 + f8b761c commit c4c808b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/happo-ci
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ echo "HAPPO_FALLBACK_SHAS_COUNT: ${HAPPO_FALLBACK_SHAS_COUNT}"
echo "Using Node version: $(node -v)"

set +e
HAPPO_VERSION=$("$HAPPO_COMMAND" version)
HAPPO_VERSION=$("$HAPPO_COMMAND" --version)
if [ $? -eq 0 ]; then
echo "Using happo CLI version: ${HAPPO_VERSION}"
else
Expand Down
2 changes: 1 addition & 1 deletion test/cli-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (/compare fail bar/.test(cmd)) {
process.exit(1);
}

if (/version/.test(cmd)) {
if (/--version/.test(cmd)) {
console.log('v0.0.999');
process.exit(0);
}
16 changes: 8 additions & 8 deletions test/happo-ci-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('when CURRENT_SHA and PREVIOUS_SHA is the same', () => {
it('runs a single report', () => {
subject();
expect(getCliLog()).toEqual([
'version',
'--version',
'run bar --link http://foo.bar/ --message Commit message',
]);
expect(getGitLog()).toEqual([
Expand All @@ -110,7 +110,7 @@ describe('when there is a report for PREVIOUS_SHA', () => {
it('runs the right happo commands', () => {
subject();
expect(getCliLog()).toEqual([
'version',
'--version',
'start-job foo bar --link http://foo.bar/ --message Commit message',
'run bar --link http://foo.bar/ --message Commit message',
'compare foo bar --link http://foo.bar/ --message Commit message --author Tom Dooner <tom@dooner.com>',
Expand All @@ -133,7 +133,7 @@ describe('when there is a report for PREVIOUS_SHA', () => {
it('runs the right happo commands', () => {
subject();
expect(getCliLog()).toEqual([
'version',
'--version',
'start-job foo bar --link http://foo.bar/ --message Commit message',
'run bar --link http://foo.bar/ --message Commit message',
'has-report foo',
Expand All @@ -159,7 +159,7 @@ describe('when there is a report for PREVIOUS_SHA', () => {
it('runs the right happo commands', () => {
subject();
expect(getCliLog()).toEqual([
'version',
'--version',
'run bar --link http://foo.bar/ --message Commit message',
'compare foo bar --link http://foo.bar/ --message Commit message --author Tom Dooner <tom@dooner.com>',
]);
Expand Down Expand Up @@ -234,7 +234,7 @@ describe('when there is no report for PREVIOUS_SHA', () => {
it('does not checkout anything, runs a single report', () => {
subject();
expect(getCliLog()).toEqual([
'version',
'--version',
'start-job no-report bar --link http://foo.bar/ --message Commit message',
'run bar --link http://foo.bar/ --message Commit message',
'compare no-report bar --link http://foo.bar/ --message Commit message --author Tom Dooner <tom@dooner.com>',
Expand All @@ -256,7 +256,7 @@ describe('when there is no report for PREVIOUS_SHA', () => {
it('runs the right happo commands', () => {
subject();
expect(getCliLog()).toEqual([
'version',
'--version',
'start-job no-report bar --link http://foo.bar/ --message Commit message',
'run bar --link http://foo.bar/ --message Commit message',
'has-report no-report',
Expand Down Expand Up @@ -288,7 +288,7 @@ describe('when the compare call fails', () => {
it('fails the script', () => {
expect(subject).toThrow();
expect(getCliLog()).toEqual([
'version',
'--version',
'start-job fail bar --link http://foo.bar/ --message Commit message',
'run bar --link http://foo.bar/ --message Commit message',
'compare fail bar --link http://foo.bar/ --message Commit message --author Tom Dooner <tom@dooner.com>',
Expand All @@ -313,7 +313,7 @@ describe('when happo.io is not installed for the PREVIOUS_SHA and HAPPO_IS_ASYNC
it('runs the right happo commands', () => {
subject();
expect(getCliLog()).toEqual([
'version',
'--version',
'start-job no-happo bar --link http://foo.bar/ --message Commit message',
'run bar --link http://foo.bar/ --message Commit message',
'has-report no-happo',
Expand Down

0 comments on commit c4c808b

Please sign in to comment.