X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Foutdated.js;fp=org.simantics.maps.server%2Fnode%2Fnode-v4.8.0-win-x64%2Fnode_modules%2Fnpm%2Ftest%2Ftap%2Foutdated.js;h=146c2007a373309d81c9b1a37c355f65fac63d9a;hb=2529be6d456deeb07c128603ce4971f1dc29b695;hp=0000000000000000000000000000000000000000;hpb=2636fc31c16c23711cf2b06a4ae8537bba9c1d35;p=simantics%2Fdistrict.git diff --git a/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/outdated.js b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/outdated.js new file mode 100644 index 00000000..146c2007 --- /dev/null +++ b/org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/outdated.js @@ -0,0 +1,127 @@ +var fs = require('graceful-fs') +var path = require('path') + +var mkdirp = require('mkdirp') +var mr = require('npm-registry-mock') +var rimraf = require('rimraf') +var test = require('tap').test + +var npm = require('../../') +var common = require('../common-tap.js') + +// config +var pkg = path.resolve(__dirname, 'outdated') +var cache = path.resolve(pkg, 'cache') +var originalLog + +var json = { + name: 'outdated', + description: 'fixture', + version: '0.0.1', + dependencies: { + underscore: '1.3.1', + async: '0.2.9', + checker: '0.5.1' + } +} + +test('setup', function (t) { + cleanup() + originalLog = console.log + mkdirp.sync(cache) + fs.writeFileSync( + path.join(pkg, 'package.json'), + JSON.stringify(json, null, 2) + ) + + process.chdir(pkg) + t.end() +}) + +test('it should not throw', function (t) { + var output = [] + var expOut = [ + path.resolve(pkg, 'node_modules', 'async') + + ':async@0.2.9' + + ':async@0.2.9' + + ':async@0.2.10' + + '\n' + + path.resolve(pkg, 'node_modules', 'checker') + + ':checker@0.5.1' + + ':checker@0.5.1' + + ':checker@0.5.2' + + '\n' + + path.resolve(pkg, 'node_modules', 'underscore') + + ':underscore@1.3.1' + + ':underscore@1.3.1' + + ':underscore@1.5.1' + ] + + var expData = [ + [ + pkg, + 'async', + '0.2.9', + '0.2.9', + '0.2.10', + '0.2.9' + ], + [ + pkg, + 'checker', + '0.5.1', + '0.5.1', + '0.5.2', + '0.5.1' + ], + [ + pkg, + 'underscore', + '1.3.1', + '1.3.1', + '1.5.1', + '1.3.1' + ] + ] + + console.log = function () {} + mr({ port: common.port }, function (er, s) { + npm.load( + { + cache: 'cache', + loglevel: 'silent', + parseable: true, + registry: common.registry + }, + function () { + npm.install('.', function (err) { + t.ifError(err, 'install success') + console.log = function () { + output.push.apply(output, arguments) + } + npm.outdated(function (er, d) { + t.ifError(er, 'outdated success') + + console.log = originalLog + + t.same(output, expOut) + t.same(d, expData) + + s.close() + t.end() + }) + }) + } + ) + }) +}) + +test('cleanup', function (t) { + cleanup() + console.log = originalLog + t.end() +}) + +function cleanup () { + rimraf.sync(pkg) +}