diff options
Diffstat (limited to 'deps/npm/test/tap/outdated-git.js')
-rw-r--r-- | deps/npm/test/tap/outdated-git.js | 64 |
1 files changed, 46 insertions, 18 deletions
diff --git a/deps/npm/test/tap/outdated-git.js b/deps/npm/test/tap/outdated-git.js index cc89ff19d98..32bfead672b 100644 --- a/deps/npm/test/tap/outdated-git.js +++ b/deps/npm/test/tap/outdated-git.js @@ -1,31 +1,59 @@ -var common = require("../common-tap.js") -var test = require("tap").test -var npm = require("../../") -var mkdirp = require("mkdirp") -var rimraf = require("rimraf") -var path = require("path") +var fs = require('graceful-fs') +var path = require('path') + +var test = require('tap').test +var mkdirp = require('mkdirp') +var rimraf = require('rimraf') + +var common = require('../common-tap.js') +var npm = require('../../') // config -var pkg = path.resolve(__dirname, "outdated-git") -var cache = path.resolve(pkg, "cache") -mkdirp.sync(cache) +var pkg = path.resolve(__dirname, 'outdated-git') +var cache = path.resolve(pkg, 'cache') +test('setup', function (t) { + setup() + t.end() +}) -test("dicovers new versions in outdated", function (t) { +test('discovers new versions in outdated', function (t) { process.chdir(pkg) t.plan(5) - npm.load({cache: cache, registry: common.registry}, function () { + npm.load({cache: cache, registry: common.registry, loglevel: 'silent'}, function () { npm.commands.outdated([], function (er, d) { - t.equal("git", d[0][3]) - t.equal("git", d[0][4]) - t.equal("git://github.com/robertkowalski/foo-private.git", d[0][5]) - t.equal("git://user:pass@github.com/robertkowalski/foo-private.git", d[1][5]) - t.equal("git+https://github.com/robertkowalski/foo", d[2][5]) + t.equal('git', d[0][3]) + t.equal('git', d[0][4]) + t.equal('git://github.com/robertkowalski/foo-private.git', d[0][5]) + t.equal('git://user:pass@github.com/robertkowalski/foo-private.git', d[1][5]) + t.equal('git+https://github.com/robertkowalski/foo', d[2][5]) }) }) }) -test("cleanup", function (t) { - rimraf.sync(cache) +test('cleanup', function (t) { + cleanup() t.end() }) + +var json = { + name: 'outdated-git', + author: 'Rocko Artischocko', + description: 'fixture', + version: '0.0.1', + main: 'index.js', + dependencies: { + 'foo-private': 'git://github.com/robertkowalski/foo-private.git', + 'foo-private-credentials': 'git://user:pass@github.com/robertkowalski/foo-private.git', + 'foo-github': 'robertkowalski/foo' + } +} + +function setup () { + mkdirp.sync(cache) + fs.writeFileSync(path.join(pkg, 'package.json'), JSON.stringify(json, null, 2), 'utf8') +} + +function cleanup () { + rimraf.sync(pkg) +} |