Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Make npm install respect config.unicode
Browse files Browse the repository at this point in the history
`npm ls` and `npm star` already do, just `npm install` was missed.
  • Loading branch information
Sean McGivern committed Apr 18, 2014
1 parent 8b5e7b6 commit e3a2ec4
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function prettify (tree, installed) {
if (g) g = " (" + g + ")"
return c.what + g
})
})
}, "", { unicode: npm.config.get("unicode") })
}).join("\n")
}

Expand Down
38 changes: 38 additions & 0 deletions test/tap/install-cli-unicode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
var common = require('../common-tap.js')
var test = require('tap').test
var npm = require('../../')
var mkdirp = require('mkdirp')
var mr = require('npm-registry-mock')
var exec = require('child_process').exec

var pkg = __dirname + '/install-cli'
var NPM_BIN = __dirname + '/../../bin/npm-cli.js'

function hasOnlyAscii (s) {
return /^[\000-\177]*$/.test(s) ;
}

test('does not use unicode with --unicode false', function (t) {
t.plan(3)
mr(common.port, function (s) {
exec('node ' + NPM_BIN + ' install --unicode false read', {
cwd: pkg
}, function(err, stdout) {
t.ifError(err)
t.ok(stdout, stdout.length)
t.ok(hasOnlyAscii(stdout))
s.close()
})
})
})

test('cleanup', function (t) {
mr(common.port, function (s) {
exec('node ' + NPM_BIN + ' uninstall read', {
cwd: pkg
}, function(err, stdout) {
s.close()
})
})
t.end()
})
1 change: 1 addition & 0 deletions test/tap/install-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Tests for `npm install` CLI output.
1 change: 1 addition & 0 deletions test/tap/install-cli/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = true
10 changes: 10 additions & 0 deletions test/tap/install-cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "install-cli",
"description": "fixture",
"version": "0.0.1",
"main": "index.js",
"dependencies": {
"read": "1.0.5"
},
"repository": "git://github.com/robertkowalski/bogusfixture"
}

0 comments on commit e3a2ec4

Please sign in to comment.