Sha256: d785d6f4a6fdfb70e458aba939048c2dfa4326a2e130769964ffbf1969638563

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

// Fixes Issue #1770
var common = require('../common-tap.js')
var test = require('tap').test
var npm = require('../../')
var osenv = require('osenv')
var path = require('path')
var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var pkg = path.resolve(__dirname, 'outdated-notarget')
var cache = path.resolve(pkg, 'cache')
var mr = require('npm-registry-mock')

test('outdated-target: if no viable version is found, show error', function (t) {
  t.plan(1)
  setup()
  mr({ port: common.port }, function (er, s) {
    npm.load({ cache: cache, registry: common.registry }, function () {
      npm.commands.update(function (er) {
        t.equal(er.code, 'ETARGET')
        s.close()
        t.end()
      })
    })
  })
})

test('cleanup', function (t) {
  process.chdir(osenv.tmpdir())
  rimraf.sync(pkg)
  t.end()
})

function setup () {
  mkdirp.sync(pkg)
  mkdirp.sync(cache)
  fs.writeFileSync(path.resolve(pkg, 'package.json'), JSON.stringify({
    author: 'Evan Lucas',
    name: 'outdated-notarget',
    version: '0.0.0',
    description: 'Test for outdated-target',
    dependencies: {
      underscore: '~199.7.1'
    }
  }), 'utf8')
  process.chdir(pkg)
}

Version data entries

5 entries across 4 versions & 1 rubygems

Version Path
node-compiler-0.9.1 vendor/node/deps/npm/test/tap/outdated-notarget.js
node-compiler-0.9.0 vendor/node-v7.2.1/deps/npm/test/tap/outdated-notarget.js
node-compiler-0.8.0 vendor/node-v7.2.0/deps/npm/test/tap/outdated-notarget.js
node-compiler-0.7.0 vendor/node-v6.9.1/deps/npm/test/tap/outdated-notarget.js
node-compiler-0.7.0 vendor/node-v7.1.0/deps/npm/test/tap/outdated-notarget.js