diff --git a/lib/pack.js b/lib/pack.js index 48548fcbdf55c..8fc89db1a0b2b 100644 --- a/lib/pack.js +++ b/lib/pack.js @@ -74,7 +74,7 @@ class Pack extends BaseCommand { for (const { arg, filename, manifest } of manifests) { const tarballData = await libpack(arg, this.npm.flatOptions) const pkgContents = await getContents(manifest, tarballData) - const tarballFilename = path.join(this.npm.config.get('pack-destination'), filename) + const tarballFilename = path.resolve(this.npm.config.get('pack-destination'), filename) if (!dryRun) await writeFile(tarballFilename, tarballData) diff --git a/test/lib/pack.js b/test/lib/pack.js index cec6e3b8cf555..523ba5d6b535d 100644 --- a/test/lib/pack.js +++ b/test/lib/pack.js @@ -53,7 +53,7 @@ t.test('should pack current directory with no arguments', (t) => { const filename = `npm-${require('../../package.json').version}.tgz` t.strictSame(OUTPUT, [[filename]]) - t.strictSame(tarballFileName, filename) + t.strictSame(tarballFileName, path.resolve(filename)) t.end() }) }) @@ -87,7 +87,7 @@ t.test('follows pack-destination config', (t) => { const filename = `npm-${require('../../package.json').version}.tgz` t.strictSame(OUTPUT, [[filename]]) - t.strictSame(tarballFileName, path.join('/tmp/test', filename)) + t.strictSame(tarballFileName, path.resolve('/tmp/test', filename)) t.end() }) })