Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Fix folders of nested sourcemaps.
Browse files Browse the repository at this point in the history
  • Loading branch information
zaius authored and Tyler Kellen committed Jan 17, 2014
1 parent 79aa89d commit d33436e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
11 changes: 10 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function(grunt) {

// Before generating any new files, remove any previously-created files.
clean: {
tests: ['tmp/bare', 'tmp/default', 'tmp/join', 'tmp/sourceMapDir1', 'tmp/sourceMapDir2']
tests: ['tmp/bare', 'tmp/default', 'tmp/join', 'tmp/sourceMapDir1', 'tmp/sourceMapDir2', 'tmp/nest']
},

// Configuration to be run (and then tested).
Expand Down Expand Up @@ -118,6 +118,15 @@ module.exports = function(grunt) {
'tmp/maps/coffeeBare.js': ['test/fixtures/coffee1.coffee'],
'tmp/maps/coffeeBareJoin.js': uniformConcatFixtures
}
},
compileNested: {
options: {
sourceMap: true
},
files: {
'tmp/nest/1/coffee.js': ['test/fixtures/coffee1.coffee'],
'tmp/nest/2/coffee.js': ['test/fixtures/coffee1.coffee']
}
}
},

Expand Down
4 changes: 2 additions & 2 deletions tasks/coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module.exports = function(grunt) {
if (options.sourceMap === true) {
var paths = createOutputPaths(f.dest);
// add sourceMapDir to options object
options = _.extend({ sourceMapDir: paths.destDir }, options);
writeFileAndMap(paths, compileWithMaps(validFiles, options, paths), options);
var fileOptions = _.extend({ sourceMapDir: paths.destDir }, options);
writeFileAndMap(paths, compileWithMaps(validFiles, fileOptions, paths), fileOptions);
} else if (options.join === true) {
writeFile(f.dest, concatInput(validFiles, options));
} else {
Expand Down
17 changes: 17 additions & 0 deletions test/coffee_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,23 @@ exports.coffee = {
'test/expected/sourceMapDir2/coffee.js.map',
'Compilation of single file with alternate source map dir should generate map');

test.done();
},
compileNested: function(test) {
'use strict';

test.expect(2);

assertFileEquality(test,
'tmp/nest/1/coffee.js.map',
'test/expected/maps/coffeeNested.js.map',
'Compilation of nested maps should respect path info');

assertFileEquality(test,
'tmp/nest/2/coffee.js.map',
'test/expected/maps/coffeeNested.js.map',
'Compilation of nested maps should change per file');

test.done();
}
};
10 changes: 10 additions & 0 deletions test/expected/maps/coffeeNested.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d33436e

Please sign in to comment.