diff --git a/spec/collect-files-spec.js b/spec/collect-files-spec.js index 94f69474..adb56b27 100644 --- a/spec/collect-files-spec.js +++ b/spec/collect-files-spec.js @@ -317,6 +317,21 @@ describe('collectFiles', function () { expect(fs.readFileSync(path.join(packagePath, 'excluded.txt'), 'utf8')).toEqual('excl1'); }).then(done, done.fail); }); + it('works with folders containing a space', function (done) { + var oldsource = sourcedir; + sourcedir = oldsource + ' with space'; + shell.mv(oldsource, sourcedir); + configurePackage({name: 'test123'}); + underTest(sourcedir).then(function (packagePath) { + destdir = packagePath; + expect(isSameDir(path.dirname(packagePath), os.tmpdir())).toBeTruthy(); + expect(fs.readFileSync(path.join(packagePath, 'root.txt'), 'utf8')).toEqual('text1'); + expect(fs.readFileSync(path.join(packagePath, 'subdir', 'sub.txt'), 'utf8')).toEqual('text2'); + expect(fs.readFileSync(path.join(packagePath, 'excluded.txt'), 'utf8')).toEqual('excl1'); + sourcedir = oldsource; + }).then(done, done.fail); + }); + it('logs progress', function (done) { var logger = new ArrayLogger(); configurePackage({ @@ -326,11 +341,10 @@ describe('collectFiles', function () { } }); underTest(sourcedir, false, logger).then(function () { - var npmPath = shell.which('npm'); expect(logger.getCombinedLog()).toEqual([ ['stage', 'packaging files'], - ['call', npmPath + ' pack ' + sourcedir], - ['call', npmPath + ' install --production'] + ['call', 'npm pack "' + sourcedir + '"'], + ['call', 'npm install --production'] ]); }).then(done, done.fail); }); diff --git a/src/tasks/collect-files.js b/src/tasks/collect-files.js index fb0bd4dc..27b5bd2f 100644 --- a/src/tasks/collect-files.js +++ b/src/tasks/collect-files.js @@ -41,7 +41,7 @@ module.exports = function collectFiles(sourcePath, useLocalDependencies, optiona targetDir = tmppath(), expectedName = expectedArchiveName(packageConfig); shell.mkdir('-p', packDir); - return runNpm(packDir, 'pack ' + path.resolve(sourcePath), logger).then(function () { + return runNpm(packDir, 'pack "' + path.resolve(sourcePath) + '"', logger).then(function () { return extractTarGz(path.join(packDir, expectedName), packDir); }).then(function () { shell.mv(path.join(packDir, 'package'), targetDir);