Skip to content

Commit 1bc4e6b

Browse files
committed
Add source map loader when using typescript
- Allows stack traces on failed tests to point to the typescript line.
1 parent 02b17d0 commit 1bc4e6b

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

generators/app/templates/_karma.conf.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ module.exports = function(config) {
103103
'karma-phantomjs-shim',
104104
'karma-coverage',
105105
'karma-jasmine',
106+
<% if (props.jsPreprocessor.key === 'typescript') { -%>
107+
'karma-sourcemap-loader',
108+
<% } -%>
106109
'karma-ng-html2js-preprocessor'
107110
],
108111

generators/app/templates/_package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"ts-loader": "~0.8.0",
6464
"tslint-loader": "~1.0.2",
6565
"typings": "~0.7.9",
66+
"karma-sourcemap-loader": "~0.3.6",
6667
<% } else if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
6768
"gulp-angular-filesort": "~1.1.1",
6869
<% } if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>

generators/app/templates/gulp/_unit-tests.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ function runTests (singleRun, done) {
3333
preprocessors[path] = ['ng-html2js'];
3434
});
3535

36+
<% if (props.jsPreprocessor.key === 'typescript') { -%>
37+
pathSrcJs.forEach(function(path) {
38+
preprocessors[path] = ['sourcemap'];
39+
});
40+
<% } -%>
41+
3642
if (singleRun) {
3743
pathSrcJs.forEach(function(path) {
3844
preprocessors[path] = ['coverage'];

0 commit comments

Comments
 (0)