Skip to content

Commit

Permalink
feat: Build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
paambaati committed Mar 4, 2020
1 parent 3d27593 commit dd9e40c
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [2.5.4] - 2020-03-04
### Fixed
- Fixes [#119](https://github.com/paambaati/codeclimate-action/issues/119) - via [`#127`](https://github.com/paambaati/codeclimate-action/pull/127).

# [2.5.3] - 2020-02-26
### Fixed
- Fixes [#109](https://github.com/paambaati/codeclimate-action/issues/109) and #117(https://github.com/paambaati/codeclimate-action/issues/117) - via [`#118`](https://github.com/paambaati/codeclimate-action/pull/118).
Expand Down
2 changes: 1 addition & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function run(downloadUrl = DOWNLOAD_URL, executable = EXECUTABLE, coverageComman
core_1.debug('✅ Coverage run completed...');
}
catch (err) {
core_1.error(err);
core_1.error(err.message);
core_1.setFailed('🚨 Coverage run failed!');
return reject(err);
}
Expand Down
6 changes: 6 additions & 0 deletions node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions node_modules/@actions/core/lib/core.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions node_modules/@actions/core/lib/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/core.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions node_modules/@actions/core/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 53 additions & 5 deletions test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ test('🧪 downloadToFile() should download the give URL and write to given file
.get('/dummy-cc-reporter')
.reply(200, () => {
return toReadableStream(`#!/bin/bash
echo "hello"
`);
echo "hello"
`);
});
await downloadToFile(
'http://localhost.test/dummy-cc-reporter',
Expand All @@ -52,8 +52,8 @@ test('🧪 run() should run the CC reporter (happy path).', async t => {
.get('/dummy-cc-reporter')
.reply(200, () => {
return toReadableStream(`#!/bin/bash
echo "$*"
`); // Dummy shell script that just echoes back all arguments.
echo "$*"
`); // Dummy shell script that just echoes back all arguments.
});

let capturedOutput = '';
Expand All @@ -70,8 +70,9 @@ test('🧪 run() should run the CC reporter (happy path).', async t => {
unhookIntercept();
} catch (err) {
unhookIntercept();
nock.cleanAll();
t.fail(err);
} finally {
nock.cleanAll();
}

t.equal(
Expand All @@ -94,6 +95,53 @@ after-build --exit-code 0
t.end();
});

// TODO: @paambaati — Figure out why this test itself passes but why tape fails with exit code 1.
test.skip('🧪 run() should exit cleanly when the coverage command fails.', async t => {
t.plan(1);
const COVERAGE_COMMAND = 'wololololo'; // Random command that doesn't exist (and so should fail).
const filePath = './test.sh';
const mock = await nock('http://localhost.test')
.get('/dummy-cc-reporter')
.reply(200, () => {
return toReadableStream(`#!/bin/bash
echo "$*"
`); // Dummy shell script that just echoes back all arguments.
});

let capturedOutput = '';
const unhookIntercept = intercept.default((text: string) => {
capturedOutput += text;
});

try {
await run(
'http://localhost.test/dummy-cc-reporter',
filePath,
COVERAGE_COMMAND
);
unhookIntercept();
t.fail('Should throw an error.');
} catch (err) {
unhookIntercept();
t.equal(
capturedOutput,
`::debug::ℹ️ Downloading CC Reporter from http://localhost.test/dummy-cc-reporter ...
::debug::✅ CC Reporter downloaded...
[command]${DEFAULT_WORKDIR}/test.sh before-build
before-build
::debug::✅ CC Reporter before-build checkin completed...
::error::Unable to locate executable file: ${COVERAGE_COMMAND}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
::error::🚨 Coverage run failed!
`,
'should fail correctly on wrong/invalid coverage command.'
);
} finally {
unlinkSync(filePath);
nock.cleanAll();
t.end();
}
});

test('💣 teardown', t => {
nock.restore();
nock.cleanAll();
Expand Down

0 comments on commit dd9e40c

Please sign in to comment.