Skip to content

Commit

Permalink
feat: log repository count (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored Aug 8, 2021
1 parent a5b7253 commit 30035d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ async function run() {
// TODO: Handle cases where temp file doesn't exists, e.g. scan was erroneous
fs.readFileSync(RESULTS_TMP, 'utf8')
);

core.info(`Scanned ${testResults.repositoryCount} repositories`);

const results = testResults.results || [];

if (results.length === 0) {
Expand Down
8 changes: 8 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ async function runEntryPoint() {
describe('entrypoint', () => {
beforeEach(() => {
mockCore.setFailed.mockClear();
mockCore.info.mockClear();

mockGithubClient.postResults.mockClear();
mockGithubClient.postResults.mockResolvedValue(undefined);
});
Expand Down Expand Up @@ -101,6 +103,12 @@ describe('entrypoint', () => {
expect(mockCore.setFailed).toHaveBeenCalledWith('Found 2 results');
});

test('logs count of scanned repositories', async () => {
await runEntryPoint();

expect(mockCore.info).toHaveBeenCalledWith('Scanned 1502 repositories');
});

test('skips result posting when there are 0 results', async () => {
mockFs.readFileSync.mockReturnValueOnce('[]');
await runEntryPoint();
Expand Down

0 comments on commit 30035d3

Please sign in to comment.