Skip to content

Commit

Permalink
Merge pull request #67 from snyk-tech-services/develop
Browse files Browse the repository at this point in the history
release change
  • Loading branch information
aarlaud authored May 7, 2021
2 parents b7ae082 + f3d1f1f commit c1c017d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
8 changes: 6 additions & 2 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,16 @@ const getDelta = async(snykTestOutput: string = '', debugMode = false):Promise<S
}


if(module.parent){
if(!module.parent || (isJestTesting() && !expect.getState().currentTestName.includes('module'))){
displayOutput(newVulns,newLicenseIssues,issueTypeFilter,mode)
}



if(newVulns.length + newLicenseIssues.length > 0){
process.exitCode = 1
} else {
process.exitCode = 0
}


} catch (err){
Expand Down
2 changes: 2 additions & 0 deletions src/lib/snyk/issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ const getNewIssues = (
MonitoredIssues.forEach((monitoredIssue) => {
newIssues = _.reject(newIssues, (issue) => {
let issueFromArray = issue.from;
let upgradePathArray = issue.upgradePath
if (mode == 'inline') {
issueFromArray = issueFromArray.slice(1, issueFromArray.length);
upgradePathArray = upgradePathArray? upgradePathArray.slice(1, issueFromArray.length):undefined;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion test/lib/index-inline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('Test End 2 End - Inline mode', () => {
expect(mockExit).toHaveBeenCalledWith(1);
});

it('Test Inline mode - no new issue go modules project', async () => {
it('Test Inline mode - no new issue gomod project', async () => {
setTimeout(() => {
stdinMock.send(
fs
Expand Down
15 changes: 1 addition & 14 deletions test/lib/index-module.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ describe('Test End 2 End - Module', () => {
.readFileSync(fixturesFolderPath + 'snykTestsOutputs/test-goof.json')
.toString(),
);
expect(consoleOutput).toContain('No new issues found !');
const expectedResult = { result: 0, newVulns: [], newLicenseIssues: [] };
expect(result).toEqual(expectedResult);
});
Expand All @@ -79,7 +78,6 @@ describe('Test End 2 End - Module', () => {
true,
);
expect(debug('snyk')).toBeTruthy();
expect(consoleOutput).toContain('No new issues found !');
const expectedResult = { result: 0, newVulns: [], newLicenseIssues: [] };
expect(result).toEqual(expectedResult);
});
Expand All @@ -94,18 +92,6 @@ describe('Test End 2 End - Module', () => {
.toString(),
);

const expectedOutput = [
'New issue introduced !',
'Security Vulnerability:',
' 1/1: Regular Expression Denial of Service (ReDoS) [High Severity]',
' Via: [email protected] => @snyk/[email protected] => [email protected]',
' Fixed in: acorn 5.7.4, 6.4.1, 7.1.1',
' Fixable by upgrade: @snyk/[email protected]=>[email protected]',
];

expectedOutput.forEach((line: string) => {
expect(consoleOutput.join()).toContain(line);
});
const expectedResult = {
result: 1,
newVulns: [
Expand Down Expand Up @@ -159,6 +145,7 @@ describe('Test End 2 End - Module', () => {
severity: 'high',
title: 'Regular Expression Denial of Service (ReDoS)',
from: [
'[email protected]',
'[email protected]',
'@snyk/[email protected]',
'[email protected]',
Expand Down

0 comments on commit c1c017d

Please sign in to comment.