Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
reset(b)
const old = new Edge({
from: a,
type: 'peer',
name: 'b',
spec: '1.2.3',
})
const neu = new Edge({
from: a,
type: 'prod',
name: 'b',
spec: '*',
})
t.matchSnapshot(old, 'clobbered edge')
t.matchSnapshot(neu, 'clobbering edge')
reset(a)
reset(b)
const abInvalid = new Edge({
from: a,
name: 'b',
spec: '1.69.420-nice',
type: 'optional',
})
t.matchSnapshot(abInvalid, 'invalid dependency')
// make it valid, and then reload
b.package.version = '1.69.420-nice'
abInvalid.reload(true)
t.equal(abInvalid.valid, true, 'valid after updating target and hard reload')
// put it back for other tests
t.throws(() => new Link({ path: '/x' }), {
message: 'must provide realpath for Link node',
})
const resolver = new Link({
path: '/x/y/z',
realpath: '/x/z/y/a/b/c',
})
t.equal(resolver.resolved,
'file:../../z/y/a/b/c', 'link resolved is relpath to realpath')
resolver.path = null
t.equal(resolver.resolved, null, 'link resolved depends on path')
resolver.path = '/x/z/y/a/b/d'
t.equal(resolver.resolved, 'file:../c', 'updates when path changes')
t.matchSnapshot(new Link({
path: '/home/user/some/other/path',
target: root,
}), 'instantiate with target specified')
t.test('link.target setter', t => {
const link = new Link({
path: '/path/to/link',
realpath: '/node-a',
pkg: { name: 'node-a', version: '1.2.3' },
})
const oldTarget = link.target
t.equal(oldTarget.linksIn.has(link), true, 'target takes note of link')
t.equal(link.package, oldTarget.package, 'link has same package as target')
const newTarget = new Node({
path: '/node-b',
ok 1 - this is fine
1..1
*/}.toString().split('\n').slice(1, -1).join('\n')
var P = require('../')
var etoa = require('events-to-array')
var ignore = [ 'pipe', 'unpipe', 'prefinish', 'finish', 'newListener', 'line' ]
var p = new P({ omitVersion: true })
var events = etoa(p, ignore)
p.on('version', function (v) {
t.fail('should not see version event')
})
var lines = []
p.on('line', lines.push.bind(lines))
p.end(tapContent)
t.matchSnapshot(lines, 'saw expected lines')
t.matchSnapshot(events, 'saw expected events')
it('stdout should match expected snapshot', () => {
tap.matchSnapshot(
testUtils.cleanSnapshotData(commandResult.stdout),
'output'
);
});
});
it('stdout should match expected snapshot', () => {
tap.matchSnapshot(
testUtils.cleanSnapshotData(commandResult.stdout),
'output'
);
});
});
---
message: 1 passed
...
not ok 2
---
message: 2 failed
...
*/}.toString().split('\n').slice(1, -1).join('\n')
var P = require('../')
var etoa = require('events-to-array')
var ignore = [ 'pipe', 'unpipe', 'prefinish', 'finish', 'newListener', 'line', 'version' ]
var p = new P({ passes: true })
var events = etoa(p, ignore)
p.end(tapContent)
t.matchSnapshot(events, 'saw expected events')
it('stdout should match expected snapshot', () => {
tap.matchSnapshot(
testUtils.cleanSnapshotData(commandResult.stdout),
'output'
);
});
});
},
addEdgeIn (edge) {
this.edgesIn.add(edge)
},
}
t.matchSnapshot(new Edge({
from: top,
type: 'peer',
name: 'a',
spec: '1.2.3',
}), 'peer dep at top level, nesting is ok')
reset(top)
reset(a)
t.matchSnapshot(new Edge({
from: top,
type: 'optional',
name: 'missing',
spec: '',
}), 'missing optional dep is fine')
reset(a)
t.matchSnapshot(new Edge({
from: a,
type: 'peer',
name: 'aa',
spec: '1.2.3',
}), 'peer dep below top level, nesting not ok')
reset(a)
reset(aa)
type: 'peer',
name: 'a',
spec: '1.2.3',
}), 'peer dep at top level, nesting is ok')
reset(top)
reset(a)
t.matchSnapshot(new Edge({
from: top,
type: 'optional',
name: 'missing',
spec: '',
}), 'missing optional dep is fine')
reset(a)
t.matchSnapshot(new Edge({
from: a,
type: 'peer',
name: 'aa',
spec: '1.2.3',
}), 'peer dep below top level, nesting not ok')
reset(a)
reset(aa)
t.matchSnapshot(new Edge({
from: a,
type: 'peer',
name: 'b',
spec: '1.2.3',
}), 'peer dep below top level, parallel ok')
reset(a)
reset(b)
from: '1.2.3',
}), 'legacy metadata with "from" and no integrity')
t.matchSnapshot(sfl('x', {
version: 'foo.tgz',
integrity: 'integral',
}), 'version (file) and integrity set')
t.matchSnapshot(sfl('x', {
version: '1.2.3',
from: '^1.2.0',
shasum: 'deadbeef0cafebad',
resolved: 'https://registry.npmjs.org/x/-/x-1.2.3.tgz',
}), 'version and range, no integrity')
t.matchSnapshot(sfl('x', {
version: 'file:x-1.2.3.tgz',
from: 'x-1.2.3.tgz',
}), 'file with from, no integrity')
t.matchSnapshot(sfl('x', {
version: 'file:x-1.2.3.tgz',
resolved: '/path/to/x-1.2.3.tgz',
}), 'file with resolved, no integrity')
t.matchSnapshot(sfl('x', {
version: 'file:x-1.2.3.tgz',
from: 'file:x-1.2.3.tgz',
resolved: '/path/to/x-1.2.3.tgz',
}), 'file with resolved and from')
t.matchSnapshot(sfl('x', {