summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/cache-ls-filenames.js
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2016-05-27 14:07:59 -0700
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2016-05-28 10:42:48 -0400
commitbd8b1ddb2007dcc8ec2a0a08e16208aa21b83400 (patch)
treeaab54a7bbc42e1477a8a2b175dfc9f9eb36ca9e2 /deps/npm/test/tap/cache-ls-filenames.js
parent16f98e589c69ffe6283aa11493fd417368708557 (diff)
downloadandroid-node-v8-bd8b1ddb2007dcc8ec2a0a08e16208aa21b83400.tar.gz
android-node-v8-bd8b1ddb2007dcc8ec2a0a08e16208aa21b83400.tar.bz2
android-node-v8-bd8b1ddb2007dcc8ec2a0a08e16208aa21b83400.zip
deps: upgrade npm to 3.9.3
Contains the following npm releases: - v3.9.0: https://github.com/npm/npm/releases/tag/v3.9.0 - v3.9.1: https://github.com/npm/npm/releases/tag/v3.9.1 - v3.9.2: https://github.com/npm/npm/releases/tag/v3.9.2 - v3.9.3: https://github.com/npm/npm/releases/tag/v3.9.3 PR-URL: https://github.com/nodejs/node/pull/7030 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'deps/npm/test/tap/cache-ls-filenames.js')
-rw-r--r--deps/npm/test/tap/cache-ls-filenames.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/deps/npm/test/tap/cache-ls-filenames.js b/deps/npm/test/tap/cache-ls-filenames.js
new file mode 100644
index 0000000000..c67bca25f3
--- /dev/null
+++ b/deps/npm/test/tap/cache-ls-filenames.js
@@ -0,0 +1,51 @@
+var t = require('tap')
+var path = require('path')
+var fs = require('fs')
+var mkdirp = require('mkdirp')
+var rimraf = require('rimraf')
+var spawn = require('child_process').spawn
+var npm = require.resolve('../../bin/npm-cli.js')
+var dir = path.resolve(__dirname, 'cache-ls-filenames')
+var node = process.execPath
+
+t.test('setup', function (t) {
+ rimraf.sync(dir)
+ mkdirp.sync(dir + '/a/b/c/d')
+ for (var i = 0; i < 5; i++) {
+ fs.writeFileSync(dir + '/file-' + i, 'x\n')
+ fs.writeFileSync(dir + '/a/b/file-' + i, 'x\n')
+ }
+ t.end()
+})
+
+function test (t, args) {
+ var child = spawn(node, [npm, 'cache', 'ls', '--cache=' + dir].concat(args))
+ var out = ''
+ child.stdout.on('data', function (c) {
+ out += c
+ })
+ child.on('close', function (code, signal) {
+ t.equal(code, 0)
+ t.equal(signal, null)
+ out.trim().split(/[\n\r]+/).map(function (filename) {
+ return filename.replace(/^~/, process.env.HOME)
+ }).forEach(function (file) {
+ // verify that all exist
+ t.ok(fs.existsSync(file), 'exists: ' + file)
+ })
+ t.end()
+ })
+}
+
+t.test('without path arg', function (t) {
+ test(t, [])
+})
+
+t.test('with path arg', function (t) {
+ test(t, ['a'])
+})
+
+t.test('cleanup', function (t) {
+ rimraf.sync(dir)
+ t.end()
+})