summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/outdated-remote.js
diff options
context:
space:
mode:
authorisaacs <nope@not.real>2019-07-03 10:23:19 -0700
committerRich Trott <rtrott@gmail.com>2019-07-18 15:12:49 -0700
commit1721034a40c5e7a0a334701dc36153adee3f27e5 (patch)
tree7b2ce5a0c5d67d2e1d817fc548571250e8c1a305 /deps/npm/test/tap/outdated-remote.js
parent6df7b6a4f9cb64d298e7fd0691c4d09679872922 (diff)
downloadandroid-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.tar.gz
android-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.tar.bz2
android-node-v8-1721034a40c5e7a0a334701dc36153adee3f27e5.zip
deps: upgrade npm to 6.10.0
PR-URL: https://github.com/nodejs/node/pull/28525 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'deps/npm/test/tap/outdated-remote.js')
-rw-r--r--deps/npm/test/tap/outdated-remote.js95
1 files changed, 95 insertions, 0 deletions
diff --git a/deps/npm/test/tap/outdated-remote.js b/deps/npm/test/tap/outdated-remote.js
new file mode 100644
index 0000000000..b3990a382c
--- /dev/null
+++ b/deps/npm/test/tap/outdated-remote.js
@@ -0,0 +1,95 @@
+'use strict'
+const path = require('path')
+const test = require('tap').test
+const Tacks = require('tacks')
+const File = Tacks.File
+const Dir = Tacks.Dir
+const common = require('../common-tap.js')
+
+const basedir = common.pkg
+const testdir = path.join(basedir, 'testdir')
+const cachedir = path.join(basedir, 'cache')
+const globaldir = path.join(basedir, 'global')
+const tmpdir = path.join(basedir, 'tmp')
+
+const conf = {
+ cwd: testdir,
+ env: common.newEnv().extend({
+ npm_config_cache: cachedir,
+ npm_config_tmp: tmpdir,
+ npm_config_prefix: globaldir,
+ npm_config_registry: common.registry,
+ npm_config_loglevel: 'warn'
+ })
+}
+
+const fixture = new Tacks(Dir({
+ cache: Dir(),
+ global: Dir(),
+ tmp: Dir(),
+ testdir: Dir({
+ node_modules: Dir({
+ 'foo-http': Dir({
+ 'package.json': File({
+ name: 'foo-http',
+ version: '1.0.0'
+ })
+ }),
+ 'foo-https': Dir({
+ 'package.json': File({
+ name: 'foo-https',
+ version: '1.0.0'
+ })
+ })
+ }),
+ 'package.json': File({
+ name: 'outdated-remote',
+ version: '1.0.0',
+ dependencies: {
+ 'foo-http': 'http://example.com/foo.tar.gz',
+ 'foo-https': 'https://example.com/foo.tar.gz'
+ }
+ })
+ })
+}))
+
+function setup () {
+ cleanup()
+ fixture.create(basedir)
+}
+
+function cleanup () {
+ fixture.remove(basedir)
+}
+
+test('setup', t => {
+ setup()
+ return common.fakeRegistry.listen()
+})
+
+test('discovers new versions in outdated', t => {
+ return common.npm(['outdated', '--json'], conf).then(([code, stdout, stderr]) => {
+ t.is(code, 1, 'npm outdated completed successfully')
+ t.comment(stdout.trim())
+ t.comment(stderr.trim())
+ const data = JSON.parse(stdout)
+ t.same(data['foo-http'], {
+ current: '1.0.0',
+ wanted: 'remote',
+ latest: 'remote',
+ location: ''
+ })
+ t.same(data['foo-https'], {
+ current: '1.0.0',
+ wanted: 'remote',
+ latest: 'remote',
+ location: ''
+ })
+ })
+})
+
+test('cleanup', t => {
+ common.fakeRegistry.close()
+ cleanup()
+ t.done()
+})