diff --git a/lib/dest/index.js b/lib/dest/index.js index 7f23a839..049ac969 100644 --- a/lib/dest/index.js +++ b/lib/dest/index.js @@ -34,6 +34,11 @@ function dest(outFolder, opt) { if (typeof sourcemapOpt === 'boolean') { sourcemapOpt = {}; } + if (typeof sourcemapOpt === 'string') { + sourcemapOpt = { + path: sourcemapOpt, + }; + } var mapStream = sourcemaps.write(sourcemapOpt.path, sourcemapOpt); var outputStream = duplexify.obj(mapStream, saveStream); diff --git a/test/dest.js b/test/dest.js index 2aaa9df2..ef0431b4 100644 --- a/test/dest.js +++ b/test/dest.js @@ -103,6 +103,32 @@ describe('dest stream', function() { stream.end(); }); + it('should not explode if the sourcemap option is string', function(done) { + var inputPath = path.join(__dirname, './fixtures/test.coffee'); + + var expectedFile = new File({ + base: __dirname, + cwd: __dirname, + path: inputPath, + contents: null, + }); + + var buffered = []; + + var onEnd = function() { + buffered.length.should.equal(1); + buffered[0].should.equal(expectedFile); + done(); + }; + + var bufferStream = through.obj(dataWrap(buffered.push.bind(buffered)), onEnd); + + var stream = vfs.dest(path.join(__dirname, './out-fixtures/'), { sourcemaps: '.' }); + stream.pipe(bufferStream); + stream.write(expectedFile); + stream.end(); + }); + it('should not explode if sourcemap option is an object', function(done) { var inputPath = path.join(__dirname, './fixtures/test.coffee'); diff --git a/test/not-owned/not-owned.txt b/test/not-owned/not-owned.txt index aeeb2943..88bf7d55 100644 --- a/test/not-owned/not-owned.txt +++ b/test/not-owned/not-owned.txt @@ -1 +1 @@ -Something new +Something new \ No newline at end of file