-
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: support dependencies tree (#287)
- Loading branch information
1 parent
a31b19c
commit d029138
Showing
8 changed files
with
2,313 additions
and
9 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
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,42 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const rimraf = require('rimraf'); | ||
const coffee = require('coffee'); | ||
const fs = require('fs'); | ||
const assert = require('assert'); | ||
|
||
const npminstall = path.join(__dirname, '..', 'bin', 'install.js'); | ||
|
||
describe('test/dependencies-tree.test.js', () => { | ||
|
||
const cwd = path.join(__dirname, 'fixtures', 'dependencies-tree'); | ||
|
||
function cleanup() { | ||
rimraf.sync(path.join(cwd, 'node_modules')); | ||
} | ||
|
||
beforeEach(cleanup); | ||
afterEach(cleanup); | ||
|
||
it('should install save dependencies tree', function* () { | ||
yield coffee.fork(npminstall, [ '-c', '--save-dependencies-tree' ], { cwd }) | ||
.debug() | ||
.expect('code', 0) | ||
.end(); | ||
const file = path.join(cwd, 'node_modules/.dependencies_tree.json'); | ||
const tree = JSON.parse(fs.readFileSync(file, 'utf8')); | ||
assert(tree['koa@^2.0.0']); | ||
assert(tree['mocha@3']); | ||
}); | ||
|
||
it('should install from dependencies tree work', function* () { | ||
yield coffee.fork(npminstall, [ '-c', '--dependencies-tree=.dependencies_tree.json' ], { cwd }) | ||
.debug() | ||
.expect('code', 0) | ||
.expect('stderr', /json 0\(0B\)/) | ||
.end(); | ||
const file = path.join(cwd, 'node_modules/.dependencies_tree.json'); | ||
assert(!fs.existsSync(file)); | ||
}); | ||
}); |
Oops, something went wrong.