diff --git a/rc.js b/rc.js index 3316cab..4fc7d0d 100644 --- a/rc.js +++ b/rc.js @@ -1,3 +1,4 @@ +var path = require('path') var minimist = require('minimist') var getAbi = require('node-abi').getAbi var detectLibc = require('detect-libc') @@ -42,9 +43,7 @@ module.exports = function (pkg) { } })) - if (rc.path === true) { - delete rc.path - } + rc.path = path.resolve(rc.path === true ? '.' : rc.path || '.') if (napi.isNapiRuntime(rc.runtime) && rc.target === process.versions.node) { rc.target = napi.getBestNapiBuildVersion() diff --git a/test/rc-test.js b/test/rc-test.js index ca86c4e..fc2ee84 100644 --- a/test/rc-test.js +++ b/test/rc-test.js @@ -19,7 +19,7 @@ test('custom config and aliases', function (t) { '--libc testlibc', '--token TOKEN' ] - runRc(t, args.join(' '), {}, function (rc) { + runRc(t, args.join(' '), {}, function (rc, tmp) { t.equal(rc.arch, 'ARCH', 'correct arch') t.equal(rc.arch, rc.a, 'arch alias') t.equal(rc.platform, 'PLATFORM', 'correct platform') @@ -30,8 +30,7 @@ test('custom config and aliases', function (t) { t.equal(rc.version, rc.v, 'version alias') t.equal(rc.help, true, 'help is set') t.equal(rc.help, rc.h, 'help alias') - t.equal(rc.path, '../some/other/path', 'correct path') - t.equal(rc.path, rc.p, 'path alias') + t.equal(rc.path, path.resolve(tmp, '../some/other/path'), 'correct path') t.equal(rc.target, '1.4.10', 'correct target') t.equal(rc.target, rc.t, 'target alias') t.equal(rc.runtime, 'electron', 'correct runtime') @@ -146,7 +145,7 @@ function runRc (t, args, env, cb) { return t.fail(e) } - cb(result) + cb(result, tmp) }) }) }