Skip to content

Commit 365c3a9

Browse files
committed
Fix test with unlicensed subdependency
This test broke because the order of output changed, not because Licensee produced the wrong results. Previously, the test checked for exact output, line by line. This PR adds the `--ndjson` flag to the invocation, parses the NDJSON output, and tests the results logically, without requiring package analyses be output in any particular order.
1 parent f8fee7e commit 365c3a9

File tree

1 file changed

+9
-20
lines changed
  • tests/unlicensed-subdependency

1 file changed

+9
-20
lines changed
Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,15 @@
11
var tap = require('tap')
22

3-
var results = require('../run')([], __dirname)
3+
var results = require('../run')(['--ndjson'], __dirname)
44

55
tap.equal(results.status, 1)
66

7-
tap.equal(
8-
results.stdout.trim(),
9-
[
10-
11-
' NOT APPROVED',
12-
' Terms: MIT',
13-
' Repository: jslicense/mit-licensed-depends-on-not-licensed.js',
14-
' Homepage: None listed',
15-
' Author: Kyle E. Mitchell <[email protected]> (https://kemitchell.com/)',
16-
' Contributors: None listed',
17-
'',
18-
19-
' NOT APPROVED',
20-
' Terms: Invalid license metadata',
21-
' Repository: jslicense/not-licensed.js',
22-
' Homepage: None listed',
23-
' Author: Kyle E. Mitchell <[email protected]> (https://kemitchell.com/)',
24-
' Contributors: None listed'
25-
].join('\n')
7+
const output = results.stdout.trim().split('\n').map(line => JSON.parse(line))
8+
9+
tap.assert(
10+
output.some(result => result.name === 'mit-licensed-depends-on-not-licensed' && result.approved === false)
11+
)
12+
13+
tap.assert(
14+
output.some(result => result.name === 'not-licensed' && result.approved === false)
2615
)

0 commit comments

Comments
 (0)