Skip to content

Commit

Permalink
Merge pull request #739 from snyk/fix/ignore-empty-fixed-in-arrays
Browse files Browse the repository at this point in the history
fix: Ignore empty fixedIn arrays
  • Loading branch information
lili2311 committed Aug 20, 2019
2 parents d8e3b43 + 1737acc commit 5dbf591
Show file tree
Hide file tree
Showing 3 changed files with 3,709 additions and 379 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function constructUnfixableText(unresolved: IssueData[]) {
}
const unfixableIssuesTextArray = [chalk.bold.white('\nIssues with no direct upgrade or patch:')];
for (const issue of unresolved) {
const extraInfo = issue.fixedIn
const extraInfo = issue.fixedIn && issue.fixedIn.length
? `\n This issue was fixed in versions: ${chalk.bold(issue.fixedIn.join(', '))}`
: '\n No upgrade or patch available';
const packageNameAtVersion = chalk.bold.whiteBright(`\n ${issue.packageName}@${issue.version}\n`);
Expand Down
6 changes: 4 additions & 2 deletions test/acceptance/display-test-results.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ test('`test ruby-app` remediation displayed', async (t) => {
await snykTest('ruby-app');
} catch (error) {
const res = error.message;
t.match(res, 'Upgrade rack@1.6.5 to rack@1.6.11 to fix', 'upgrade advice displayed');
t.match(res, 'Tested 3 dependencies for known issues, found 6 issues, 8 vulnerable paths.');
t.match(res, 'Upgrade rails@5.2.3 to rails@5.2.3 to fix', 'upgrade advice displayed');
t.match(res, 'Tested 52 dependencies for known issues');
t.match(res, 'This issue was fixed in versions: 1.2.3', 'fixed in is shown');
t.match(res, 'No upgrade or patch available', 'some have no upgrade or patch');
}

snykTestStub.restore();
Expand Down

0 comments on commit 5dbf591

Please sign in to comment.