Skip to content

Commit f225459

Browse files
santigimenorvagg
authored andcommitted
test: improve test-npm-install
Make npm install a dependency that is defined as a relative path, so it avoids any network interaction. PR-URL: #5613 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
1 parent cceae5a commit f225459

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test/parallel/test-npm-install.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ const args = [
2222
'install'
2323
];
2424

25-
const pkgContent = '{}';
25+
const pkgContent = JSON.stringify({
26+
dependencies: {
27+
'package-name': common.fixturesDir + '/packages/main'
28+
}
29+
});
2630

2731
const pkgPath = path.join(common.tmpDir, 'package.json');
2832

@@ -35,6 +39,9 @@ const proc = spawn(process.execPath, args, {
3539
function handleExit(code, signalCode) {
3640
assert.equal(code, 0, 'npm install should run without an error');
3741
assert.ok(signalCode === null, 'signalCode should be null');
42+
assert.doesNotThrow(function() {
43+
fs.accessSync(common.tmpDir + '/node_modules/package-name');
44+
});
3845
}
3946

4047
proc.on('exit', common.mustCall(handleExit));

0 commit comments

Comments
 (0)