-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow disable dedupe mode on node project (#279)
* test: add node 11
- Loading branch information
Showing
10 changed files
with
98 additions
and
22 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,45 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const rimraf = require('rimraf'); | ||
const path = require('path'); | ||
const coffee = require('coffee'); | ||
const npminstall = path.join(__dirname, '..', 'bin', 'install.js'); | ||
|
||
describe('test/disable-dedupe.test.js', () => { | ||
const root = path.join(__dirname, 'fixtures', 'disable-dedupe'); | ||
const root2 = path.join(__dirname, 'fixtures', 'disable-dedupe-config'); | ||
|
||
function cleanup() { | ||
rimraf.sync(path.join(root, 'node_modules')); | ||
rimraf.sync(path.join(root2, 'node_modules')); | ||
} | ||
|
||
beforeEach(cleanup); | ||
afterEach(cleanup); | ||
|
||
it('should install --disable-dedupe work', function* () { | ||
yield coffee.fork(npminstall, [ '--disable-dedupe' ], { cwd: root }) | ||
.debug() | ||
.expect('code', 0) | ||
.expect('stderr', /disable dedupe mode/) | ||
.end(); | ||
const names = fs.readdirSync(path.join(root, 'node_modules')) | ||
.filter(n => !/^[\.\_]/.test(n)); | ||
assert(names.length === 1); | ||
assert(names[0] === 'koa'); | ||
}); | ||
|
||
it('should install config.npminstall.disableDedupe=true work', function* () { | ||
yield coffee.fork(npminstall, { cwd: root2 }) | ||
.debug() | ||
.expect('code', 0) | ||
.expect('stderr', /disable dedupe mode/) | ||
.end(); | ||
const names = fs.readdirSync(path.join(root2, 'node_modules')) | ||
.filter(n => !/^[\.\_]/.test(n)); | ||
assert(names.length === 1); | ||
assert(names[0] === 'koa'); | ||
}); | ||
}); |
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,11 @@ | ||
{ | ||
"name": "disable-dedupe-demo", | ||
"dependencies": { | ||
"koa": "2" | ||
}, | ||
"config": { | ||
"npminstall": { | ||
"disableDedupe": true | ||
} | ||
} | ||
} |
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,6 @@ | ||
{ | ||
"name": "disable-dedupe-demo", | ||
"dependencies": { | ||
"koa": "2" | ||
} | ||
} |
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
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