Skip to content

Commit

Permalink
test: check pkglock is updated correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
feelepxyz authored and larsgw committed Oct 30, 2018
1 parent 63d5065 commit 26e3e2a
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions test/tap/install-dep-classification.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ test('optional dependency identification', function (t) {
t.is(code, 0, 'no error code')
t.is(stderr, '', 'no error output')
t.notOk(fs.existsSync(path.join(optionalDir, 'node_modules')), 'did not install anything')
t.similar(JSON.parse(fs.readFileSync(path.join(optionalDir, 'package-lock.json'), 'utf8')), {
dependencies: {
a: {
version: 'file:../a-1.0.0.tgz',
optional: true,
},
b: {
version: 'file:../b-1.0.0.tgz',
optional: true
},
example: {
version: "1.0.0",
optional: true,
}
}
}, 'locks dependencies as optional')
t.end()
}
)
Expand All @@ -89,6 +105,50 @@ test('development dependency identification', function (t) {
t.is(code, 0, 'no error code')
t.is(stderr, '', 'no error output')
t.notOk(fs.existsSync(path.join(devDir, 'node_modules')), 'did not install anything')
t.similar(JSON.parse(fs.readFileSync(path.join(devDir, 'package-lock.json'), 'utf8')), {
dependencies: {
a: {
version: 'file:../a-1.0.0.tgz',
dev: true,
},
b: {
version: 'file:../b-1.0.0.tgz',
dev: true
},
example: {
version: "1.0.0",
dev: true,
}
}
}, 'locks dependencies as dev')
t.end()
}
)
})

test('default dependency identification', function (t) {
common.npm(
['install'],
{cwd: optionalDir},
function (er, code, stdout, stderr) {
t.is(code, 0, 'no error code')
t.is(stderr, '', 'no error output')
t.similar(JSON.parse(fs.readFileSync(path.join(optionalDir, 'package-lock.json'), 'utf8')), {
dependencies: {
a: {
version: 'file:../a-1.0.0.tgz',
optional: true,
},
b: {
version: 'file:../b-1.0.0.tgz',
optional: true
},
example: {
version: "1.0.0",
optional: true,
}
}
}, 'locks dependencies as optional')
t.end()
}
)
Expand Down

0 comments on commit 26e3e2a

Please sign in to comment.