diff options
Diffstat (limited to 'deps/npm/test/tap/check-engine-reqs.js')
-rw-r--r-- | deps/npm/test/tap/check-engine-reqs.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/deps/npm/test/tap/check-engine-reqs.js b/deps/npm/test/tap/check-engine-reqs.js index 7cbbcd354f..eec0756288 100644 --- a/deps/npm/test/tap/check-engine-reqs.js +++ b/deps/npm/test/tap/check-engine-reqs.js @@ -2,9 +2,7 @@ var path = require('path') var fs = require('fs') var test = require('tap').test -var osenv = require('osenv') var mkdirp = require('mkdirp') -var rimraf = require('rimraf') var common = require('../common-tap.js') var base = common.pkg @@ -27,7 +25,6 @@ test('setup', function (t) { var INSTALL_OPTS = ['--loglevel', 'silly'] var EXEC_OPTS = {cwd: installIn} - test('install bad engine', function (t) { common.npm(['install', '--engine-strict', installFrom].concat(INSTALL_OPTS), EXEC_OPTS, function (err, code) { t.ifError(err, 'npm ran without issue') @@ -43,18 +40,19 @@ test('force install bad engine', function (t) { }) }) -test('cleanup', function (t) { - cleanup() - t.end() +test('warns on bad engine not strict', function (t) { + common.npm(['install', '--json', installFrom], EXEC_OPTS, function (err, code, stdout, stderr) { + t.ifError(err, 'npm ran without issue') + t.is(code, 0, 'result code') + var result = JSON.parse(stdout) + t.match(result.warnings[0], /Unsupported engine/, 'reason for optional failure in JSON') + t.match(result.warnings[0], /1.0.0-not-a-real-version/, 'should print mismatch version info') + t.match(result.warnings[0], /Not compatible with your version of node/, 'incompatibility message') + t.done() + }) }) -function cleanup () { - process.chdir(osenv.tmpdir()) - rimraf.sync(base) -} - function setup () { - cleanup() mkdirp.sync(path.resolve(installFrom, 'node_modules')) fs.writeFileSync( path.join(installFrom, 'package.json'), |