Skip to content

Commit

Permalink
fix: web-ext sign now exits with a non-zero status if signing fails (
Browse files Browse the repository at this point in the history
  • Loading branch information
shubheksha authored and kumar303 committed Oct 17, 2016
1 parent 76a987f commit 74a208d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/cmd/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import defaultAddonSigner from 'sign-addon';

import defaultBuilder from './build';
import {withTempDir} from '../util/temp-dir';
import {isErrorWithCode, UsageError} from '../errors';
import {isErrorWithCode, UsageError, WebExtError} from '../errors';
import getValidatedManifest, {getManifestId} from '../util/manifest';
import {prepareArtifactsDir} from '../util/artifacts';
import {createLogger} from '../util/logger';
Expand Down Expand Up @@ -120,6 +120,8 @@ export default function sign(
log.info('SUCCESS');
} else {
log.info('FAIL');
throw new WebExtError(
'The WebExtension could not be signed');
}

return signingResult;
Expand Down
9 changes: 6 additions & 3 deletions tests/unit/test-cmd/test.sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {assert} from 'chai';
import sinon from 'sinon';
import promisify from 'es6-promisify';

import {onlyInstancesOf, UsageError} from '../../../src/errors';
import {onlyInstancesOf, UsageError, WebExtError} from '../../../src/errors';
import {getManifestId} from '../../../src/util/manifest';
import {withTempDir} from '../../../src/util/temp-dir';
import {basicManifest, manifestWithoutApps} from '../test-util/test.manifest';
Expand Down Expand Up @@ -248,8 +248,11 @@ describe('sign', () => {
success: false,
}),
})
.then((result) => {
assert.equal(result.success, false);
.then(makeSureItFails())
.catch((error) => {
assert.instanceOf(error, WebExtError);
assert.match(error.message,
/The WebExtension could not be signed/);
});
}
));
Expand Down

0 comments on commit 74a208d

Please sign in to comment.