Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/read-package-tree/test/basic.js')
-rw-r--r--node_modules/read-package-tree/test/basic.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/node_modules/read-package-tree/test/basic.js b/node_modules/read-package-tree/test/basic.js
index 0f9a33621..0dcb53891 100644
--- a/node_modules/read-package-tree/test/basic.js
+++ b/node_modules/read-package-tree/test/basic.js
@@ -4,7 +4,7 @@ var path = require('path')
var fs = require('fs')
var archy = require('archy')
var fixtures = path.resolve(__dirname, 'fixtures')
-var roots = [ 'root', 'other', 'selflink' ]
+var roots = [ 'root', 'other', 'selflink', 'noname' ]
var cwd = path.resolve(__dirname, '..')
var symlinks = {
@@ -42,7 +42,8 @@ test('setup symlinks', function (t) {
roots.forEach(function (root) {
var dir = path.resolve(fixtures, root)
- var out = path.resolve(dir, 'archy.txt')
+ var expectedtxt = path.resolve(dir, 'archy.txt')
+ var expectedre = path.resolve(dir, 'archy.re')
test(root, function (t) {
rpt(dir, function (er, d) {
@@ -54,8 +55,13 @@ roots.forEach(function (root) {
// console . log (require ('util') . inspect (d, {
// depth: Infinity
// }))
- var expect = fs.readFileSync(out, 'utf8').trim()
- t.equal(actual, expect, root + ' tree')
+ try {
+ var expect = fs.readFileSync(expectedtxt, 'utf8').trim()
+ t.equal(actual, expect, root + ' tree')
+ } catch (e) {
+ var expect = new RegExp(fs.readFileSync(expectedre, 'utf8').trim())
+ t.like(actual, expect, root + ' tree')
+ }
t.end()
})
})
@@ -126,7 +132,9 @@ function archyize (d, seen) {
path = d.target.path
}
- var label = d.package._id ? d.package._id + ' ' : ''
+ var label = d.package._id ? d.package._id + ' ' :
+ d.package.name ? d.package.name + (d.package.version ? '@' + d.package.version : '') + ' ' :
+ ''
label += path.substr(cwd.length + 1)
if (d . target) {