Debian Codegraph @

workspaces/arborist/test/fixtures/external-link/test.js

raw
1 const t = require('tap')
2
3 const printEdge = edge => ({
4 from: edge.from.location,
5 name: edge.name,
6 ...(edge.spec !== '' ? { spec: edge.spec } : {}),
7 ...(edge.to ? { to: edge.to.location } : {}),
8 ...(edge.error ? { error: edge.error } : {}),
9 })
10
11 t.test('check resolution', async t => {
12 const Arborist = require('../')
13 const arb = new Arborist({ path: __dirname + '/root' })
14 const tree = await arb.loadActual()
15 let ok = true
16 for (const node of [tree, ...tree.inventory.values()]) {
17 for (const edge of node.edgesOut.values()) {
18 if (!edge.valid) {
19 t.fail('invalid edge', { edge: printEdge(edge), at: null })
20 }
21 }
22 }
23 })