Skip to content

Commit

Permalink
Add Source Map tester
Browse files Browse the repository at this point in the history
  • Loading branch information
vladikoff committed Jul 19, 2014
1 parent 4186f06 commit cb6aab5
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 2 deletions.
26 changes: 25 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,31 @@ module.exports = function(grunt) {
'test/fixtures/file2'
]
}
}
},
sourcemap_js: {
options: {
banner: '/*\nJS Banner\n*/\n',
sourceMap: true
},
files: {
'tmp/sourcemap_js.js': [
'test/fixtures/js1.js',
'test/fixtures/js2.js'
]
}
},
sourcemap_css: {
options: {
banner: '/*\nCSS Banner\n*/\n',
sourceMap: true
},
files: {
'tmp/sourcemap_css.css': [
'test/fixtures/css1.css',
'test/fixtures/css2.css'
]
}
},
},

// Unit tests.
Expand Down
10 changes: 9 additions & 1 deletion test/concat_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ exports.concat = {
test.done();
},
sourcemap_options: function(test) {
test.expect(3);
test.expect(5);

var actual = getNormalizedFile('tmp/sourcemap_inline');
var expected = getNormalizedFile('test/expected/sourcemap_inline');
Expand All @@ -97,6 +97,14 @@ exports.concat = {
expected = getNormalizedFile('test/expected/sourcemap3_embed.map');
test.equal(actual, expected, 'should output the constructed map.');

actual = getNormalizedFile('tmp/sourcemap_js.js.map');
expected = getNormalizedFile('test/expected/sourcemap_js.js.map');
test.equal(actual, expected, 'should output the js map.');

actual = getNormalizedFile('tmp/sourcemap_css.css.map');
expected = getNormalizedFile('test/expected/sourcemap_css.css.map');
test.equal(actual, expected, 'should output the css map.');

test.done();
}
};
36 changes: 36 additions & 0 deletions test/expected/sourcemap_css.css

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

1 change: 1 addition & 0 deletions test/expected/sourcemap_css.css.map

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

25 changes: 25 additions & 0 deletions test/expected/sourcemap_js.js

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

1 change: 1 addition & 0 deletions test/expected/sourcemap_js.js.map

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

15 changes: 15 additions & 0 deletions test/fixtures/css1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
body {
text-align: left;
}



/* CSS is cool */





div {
font-family: Roboto;
}
15 changes: 15 additions & 0 deletions test/fixtures/css2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* {
text-align: right;
}



/**
Headers
*/

h2 {
font-family: Arial;
}
8 changes: 8 additions & 0 deletions test/fixtures/js1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var x = 1;


/**
* Redefine "x"
* @type {number}
*/
x = 10;
11 changes: 11 additions & 0 deletions test/fixtures/js2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var y = 2;







y = 5;
debugger;
// End of this test file
13 changes: 13 additions & 0 deletions test/sourcemap_tester.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="/tmp/sourcemap_css.css">
<script src="/tmp/sourcemap_js.js"></script>
</head>
<body>
<div>DIV</div>
<h2>H2</h2>
</body>
</html>

0 comments on commit cb6aab5

Please sign in to comment.