(t, { command, error, ...config } = {})
| 3 | const tmock = require('../../fixtures/tmock') |
| 4 | |
| 5 | const auditError = async (t, { command, error, ...config } = {}) => { |
| 6 | const mockAuditError = tmock(t, '{LIB}/utils/audit-error') |
| 7 | |
| 8 | const mock = await mockNpm(t, { |
| 9 | command, |
| 10 | config, |
| 11 | exec: true, |
| 12 | prefixDir: { 'package.json': '{}', 'package-lock.json': '{}' }, |
| 13 | }) |
| 14 | |
| 15 | const res = {} |
| 16 | try { |
| 17 | res.result = mockAuditError(mock.npm, error ? { error } : {}) |
| 18 | } catch (err) { |
| 19 | res.error = err |
| 20 | } |
| 21 | |
| 22 | mock.npm.finish() |
| 23 | |
| 24 | return { |
| 25 | ...res, |
| 26 | logs: mock.logs.warn.byTitle('audit'), |
| 27 | output: mock.joinedOutput(), |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | t.test('no error, not audit command', async t => { |
| 32 | const { result, error, logs, output } = await auditError(t, { command: 'install' }) |
no test coverage detected
searching dependent graphs…