Skip to content

Commit c78198e

Browse files
authored
test: improve coverage (#8)
1 parent 6c71862 commit c78198e

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed
Binary file not shown.

__tests__/__snapshots__/app.test.js.snap

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`Commit with broken manifest should be ignored 1`] = `
4+
"
5+
Reviewing your dependencies...
6+
7+
Checking dependency: lodash
8+
-> introduced via commit sha: cba680064122389350203e90b2cbc8705de23b63
9+
Checking dependency: async
10+
-> introduced via commit sha: 456e6f36b5494ff6c2437347ac3ec220248e09c8
11+
"
12+
`;
13+
314
exports[`Debug information prints commit SHA 1`] = `
415
"
516
Reviewing your dependencies...

__tests__/app.test.js

+27-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ const { testProject } = require('../src')
44

55
const decompress = require('decompress')
66

7-
const projectFixtures = ['simple-project.zip', 'small-project.zip']
7+
jest.setTimeout(30000)
8+
9+
const projectFixtures = [
10+
'simple-project.zip',
11+
'small-project.zip',
12+
'commit-with-broken-package-json.zip'
13+
]
814

915
const destinationFixtures = path.resolve(path.join(__dirname, '__fixtures__', 'tmp'))
1016

@@ -55,3 +61,23 @@ test('Debug information prints commit SHA', async () => {
5561
})
5662
expect(out).toMatchSnapshot()
5763
})
64+
65+
// Check the case when commit contains invalid package.json file,
66+
// for example with extra comma.
67+
// commit 456e6f36b5494ff6c2437347ac3ec220248e09c8 fix previous commit
68+
// commit 6b2a52e3177c8b1fad572b10d3090d1e9822945f add async
69+
// --> This commit introduces extra comma after the last dependency
70+
// commit cba680064122389350203e90b2cbc8705de23b63 add lodash
71+
test('Commit with broken manifest should be ignored', async () => {
72+
const projectPath = path.resolve(
73+
path.join(destinationFixtures, 'commit-with-broken-package-json')
74+
)
75+
76+
let out = ''
77+
await testProject({
78+
projectPath,
79+
log: (...args) => (out += `${args.join(' ')}\n`),
80+
debugMode: true
81+
})
82+
expect(out).toMatchSnapshot()
83+
})

0 commit comments

Comments
 (0)