-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "install: do not descend into directory deps' child modules"
This reverts commit 45772af Fix: https://npm.community/t/6-11-1-some-dependencies-are-no-longer-being-installed/9586/4 Also adds 2 tests to verify regression behavior. PR-URL: #242 Credit: @isaacs Close: #242 Reviewed-by: @claudiahdz
- Loading branch information
1 parent
235ed1d
commit 1fafb51
Showing
5 changed files
with
127 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// XXX Remove in npm v7, when this is no longer how we do things | ||
const t = require('tap') | ||
const common = require('../common-tap.js') | ||
const pkg = common.pkg | ||
const mkdirp = require('mkdirp') | ||
const { writeFileSync, statSync } = require('fs') | ||
const { resolve } = require('path') | ||
const mr = require('npm-registry-mock') | ||
const rimraf = require('rimraf') | ||
|
||
t.test('setup', t => { | ||
mkdirp.sync(resolve(pkg, 'node_modules')) | ||
mkdirp.sync(resolve(pkg, 'foo')) | ||
writeFileSync(resolve(pkg, 'foo', 'package.json'), JSON.stringify({ | ||
name: 'foo', | ||
version: '1.2.3', | ||
dependencies: { | ||
underscore: '*' | ||
} | ||
})) | ||
|
||
writeFileSync(resolve(pkg, 'package.json'), JSON.stringify({ | ||
name: 'root', | ||
version: '1.2.3', | ||
dependencies: { | ||
foo: 'file:foo' | ||
} | ||
})) | ||
|
||
mr({ port: common.port }, (er, s) => { | ||
if (er) { | ||
throw er | ||
} | ||
t.parent.teardown(() => s.close()) | ||
t.end() | ||
}) | ||
}) | ||
|
||
t.test('initial install to create package-lock', | ||
t => common.npm(['install', '--registry', common.registry], { cwd: pkg }) | ||
.then(([code]) => t.equal(code, 0, 'command worked'))) | ||
|
||
t.test('remove node_modules', t => | ||
rimraf(resolve(pkg, 'node_modules'), t.end)) | ||
|
||
t.test('install again from package-lock', t => | ||
common.npm(['install', '--registry', common.registry], { cwd: pkg }) | ||
.then(([code]) => { | ||
t.equal(code, 0, 'command worked') | ||
const underscore = resolve(pkg, 'node_modules', 'underscore') | ||
t.equal(statSync(underscore).isDirectory(), true, 'underscore installed') | ||
})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
const t = require('tap') | ||
const common = require('../common-tap.js') | ||
const mkdirp = require('mkdirp') | ||
const { writeFileSync, readFileSync } = require('fs') | ||
const { resolve } = require('path') | ||
const pkg = common.pkg | ||
const app = resolve(pkg, 'app') | ||
const lib = resolve(pkg, 'lib') | ||
const moda = resolve(lib, 'module-a') | ||
const modb = resolve(lib, 'module-b') | ||
|
||
const rimraf = require('rimraf') | ||
|
||
t.test('setup', t => { | ||
mkdirp.sync(app) | ||
mkdirp.sync(moda) | ||
mkdirp.sync(modb) | ||
|
||
writeFileSync(resolve(app, 'package.json'), JSON.stringify({ | ||
name: 'app', | ||
version: '1.2.3', | ||
dependencies: { | ||
moda: 'file:../lib/module-a' | ||
} | ||
})) | ||
|
||
writeFileSync(resolve(moda, 'package.json'), JSON.stringify({ | ||
name: 'moda', | ||
version: '1.2.3', | ||
dependencies: { | ||
modb: 'file:../module-b' | ||
} | ||
})) | ||
|
||
writeFileSync(resolve(modb, 'package.json'), JSON.stringify({ | ||
name: 'modb', | ||
version: '1.2.3' | ||
})) | ||
|
||
t.end() | ||
}) | ||
|
||
t.test('initial install to create package-lock', | ||
t => common.npm(['install'], { cwd: app }) | ||
.then(([code]) => t.equal(code, 0, 'command worked'))) | ||
|
||
t.test('remove node_modules', t => | ||
rimraf(resolve(pkg, 'node_modules'), t.end)) | ||
|
||
t.test('install again from package-lock', t => | ||
common.npm(['install'], { cwd: app }) | ||
.then(([code]) => { | ||
t.equal(code, 0, 'command worked') | ||
// verify that module-b is linked under module-a | ||
const depPkg = resolve( | ||
app, | ||
'node_modules', | ||
'moda', | ||
'node_modules', | ||
'modb', | ||
'package.json' | ||
) | ||
const data = JSON.parse(readFileSync(depPkg, 'utf8')) | ||
t.strictSame(data, { | ||
name: 'modb', | ||
version: '1.2.3' | ||
}) | ||
})) |
This file was deleted.
Oops, something went wrong.