Permalink
Browse files

fix: Exit with 1 if unexpected error happens

  • Loading branch information...
pvdlg committed Oct 6, 2017
1 parent 85dd69b commit 90417c6ffe35c6ba479121a60085f0cfd35c6d1e
Showing with 26 additions and 1 deletion.
  1. +3 −1 bin/semantic-release.js
  2. +23 −0 test/integration.test.js
View
@@ -23,4 +23,6 @@ npx is bundled with npm >= 5.4, or available via npm. More info: npm.im/npx`
}
// node 8+ from this point on
require('../src')();
require('../src')().catch(() => {
process.exit(1);
});
View
@@ -207,3 +207,26 @@ test.serial('Release versions from a packed git repository, using tags to determ
t.is(version, '1.0.1');
t.log(`+ released ${version}`);
});
test.serial('Exit with 1 in a plugin is not found', async t => {
// Environment variables used with cli
const env = {
CI: true,
npm_config_registry: uri,
GH_TOKEN: 'github_token',
NPM_OLD_TOKEN: 'aW50ZWdyYXRpb246c3VjaHNlY3VyZQ==',
NPM_EMAIL: 'integration@test.com',
};
// Create a git repository, set the current working directory at the root of the repo
t.log('Create git repository');
await gitRepo();
await writeJson('./package.json', {
name: 'test-module-3',
version: '0.0.0-dev',
repository: {url: 'git+https://github.com/semantic-release/test-module-4'},
release: {analyzeCommits: 'non-existing-path'},
});
const {code} = await t.throws(execa(require.resolve('../bin/semantic-release'), ['pre'], {env}));
t.is(code, 1);
});

0 comments on commit 90417c6

Please sign in to comment.