-
Notifications
You must be signed in to change notification settings - Fork 573
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add --json-file-output option for snyk test
- Loading branch information
Showing
12 changed files
with
339 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
export class CommandResult { | ||
result: string; | ||
constructor(result: string) { | ||
this.result = result; | ||
} | ||
|
||
public toString(): string { | ||
return this.result; | ||
} | ||
|
||
public getDisplayResults() { | ||
return this.result; | ||
} | ||
} | ||
|
||
export abstract class TestCommandResult extends CommandResult { | ||
protected jsonResult = ''; | ||
public getJsonResult(): string { | ||
return this.jsonResult; | ||
} | ||
|
||
public static createHumanReadableTestCommandResult( | ||
humanReadableResult: string, | ||
jsonResult: string, | ||
): HumanReadableTestCommandResult { | ||
return new HumanReadableTestCommandResult(humanReadableResult, jsonResult); | ||
} | ||
|
||
public static createJsonTestCommandResult( | ||
jsonResult: string, | ||
): JsonTestCommandResult { | ||
return new JsonTestCommandResult(jsonResult); | ||
} | ||
} | ||
|
||
class HumanReadableTestCommandResult extends TestCommandResult { | ||
protected jsonResult = ''; | ||
|
||
constructor(humanReadableResult: string, jsonResult: string) { | ||
super(humanReadableResult); | ||
this.jsonResult = jsonResult; | ||
} | ||
|
||
public getJsonResult(): string { | ||
return this.jsonResult; | ||
} | ||
} | ||
|
||
class JsonTestCommandResult extends TestCommandResult { | ||
constructor(jsonResult: string) { | ||
super(jsonResult); | ||
} | ||
|
||
public getJsonResult(): string { | ||
return this.result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.