filter vulnerabilities by audit_level (#55)
* filter vulnerabilities by audit_level * update README.md * fix test cases * restrict audit_level value * update dist/index.js
This commit is contained in:
@@ -30,7 +30,7 @@ describe('run', () => {
|
||||
}
|
||||
})
|
||||
|
||||
audit.run()
|
||||
audit.run('low')
|
||||
expect(audit.foundVulnerability()).toBeTruthy()
|
||||
})
|
||||
|
||||
@@ -51,7 +51,7 @@ describe('run', () => {
|
||||
}
|
||||
})
|
||||
|
||||
audit.run()
|
||||
audit.run('low')
|
||||
expect(audit.foundVulnerability()).toBeFalsy()
|
||||
})
|
||||
|
||||
@@ -69,7 +69,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
expect.assertions(1)
|
||||
const r = audit.run()
|
||||
const r = audit.run('low')
|
||||
const e = new Error('Something is wrong')
|
||||
await expect(r).rejects.toEqual(e)
|
||||
})
|
||||
@@ -88,7 +88,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
expect.assertions(1)
|
||||
const r = audit.run()
|
||||
const r = audit.run('low')
|
||||
const e = new Error('the subprocess terminated due to a signal.')
|
||||
await expect(r).rejects.toEqual(e)
|
||||
})
|
||||
@@ -107,7 +107,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
expect.assertions(1)
|
||||
const r = audit.run()
|
||||
const r = audit.run('low')
|
||||
const e = new Error('Something is wrong')
|
||||
await expect(r).rejects.toEqual(e)
|
||||
})
|
||||
|
||||
@@ -14,6 +14,7 @@ describe('run', () => {
|
||||
mocked(Audit).mockClear()
|
||||
mocked(pr).createComment.mockClear()
|
||||
|
||||
process.env.INPUT_AUDIT_LEVEL = 'low'
|
||||
process.env.INPUT_GITHUB_CONTEXT =
|
||||
'{ "event_name": "pull_request", "event": { "number": 100} }'
|
||||
process.env.INPUT_GITHUB_TOKEN = '***'
|
||||
@@ -27,7 +28,7 @@ describe('run', () => {
|
||||
path.join(__dirname, 'testdata/audit/success.txt')
|
||||
),
|
||||
status: 0,
|
||||
run: (): Promise<void> => {
|
||||
run: (auditLevel: string): Promise<void> => {
|
||||
return Promise.resolve(void 0)
|
||||
},
|
||||
foundVulnerability: (): boolean => {
|
||||
@@ -60,7 +61,7 @@ describe('run', () => {
|
||||
path.join(__dirname, 'testdata/audit/error.txt')
|
||||
),
|
||||
status: 1,
|
||||
run: (): Promise<void> => {
|
||||
run: (auditLevel: string): Promise<void> => {
|
||||
return Promise.resolve(void 0)
|
||||
},
|
||||
foundVulnerability: (): boolean => {
|
||||
|
||||
Reference in New Issue
Block a user