Skip to content

Commit

Permalink
Add source map loader when using typescript
Browse files Browse the repository at this point in the history
- Allows stack traces on failed tests to point to the typescript line.
  • Loading branch information
nabil-boag committed Apr 13, 2016
1 parent 02b17d0 commit 1bc4e6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions generators/app/templates/_karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ module.exports = function(config) {
'karma-phantomjs-shim',
'karma-coverage',
'karma-jasmine',
<% if (props.jsPreprocessor.key === 'typescript') { -%>
'karma-sourcemap-loader',
<% } -%>
'karma-ng-html2js-preprocessor'
],

Expand Down
1 change: 1 addition & 0 deletions generators/app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"ts-loader": "~0.8.0",
"tslint-loader": "~1.0.2",
"typings": "~0.7.9",
"karma-sourcemap-loader": "~0.3.6",
<% } else if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
"gulp-angular-filesort": "~1.1.1",
<% } if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>
Expand Down
6 changes: 6 additions & 0 deletions generators/app/templates/gulp/_unit-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ function runTests (singleRun, done) {
preprocessors[path] = ['ng-html2js'];
});

<% if (props.jsPreprocessor.key === 'typescript') { -%>
pathSrcJs.forEach(function(path) {
preprocessors[path] = ['sourcemap'];
});
<% } -%>

if (singleRun) {
pathSrcJs.forEach(function(path) {
preprocessors[path] = ['coverage'];
Expand Down

0 comments on commit 1bc4e6b

Please sign in to comment.