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

Commit

Permalink
Use glob.sync to loadFiles with angular2 Workaround for karma-runner/…
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelmbagira committed Apr 26, 2016
1 parent c426c44 commit 3213e61
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
20 changes: 13 additions & 7 deletions generators/app/conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

const lit = require('fountain-generator').lit;

module.exports = function karmaConf(props) {
Expand Down Expand Up @@ -102,20 +104,24 @@ module.exports = function karmaConf(props) {
config: 'jspm.config.js',
browser: 'jspm.test.js'
};

let files;
if (props.js === 'typescript') {
if (props.framework === 'react') {
conf.jspm.loadFiles.push(lit`conf.path.src('app/**/*.tsx')`);
files = lit`conf.path.src('app/**/*.tsx')`;
} else {
conf.jspm.loadFiles.push(lit`conf.path.src('app/**/*.ts')`);
files = lit`conf.path.src('app/**/*.ts')`;
}
} else {
conf.jspm.loadFiles.push(lit`conf.path.src('app/**/*.js')`);
files = lit`conf.path.src('app/**/*.js')`;
}

// if (props.framework !== 'react') {
if (props.framework === 'angular1') {
if (props.framework === 'angular2') {
// http://stackoverflow.com/questions/35873437/enfile-file-table-overflow-with-karma
conf.jspm.loadFiles = lit`glob.sync(${files})`;
} else if (props.framework === 'angular1') {
conf.jspm.loadFiles.push(files);
conf.jspm.loadFiles.push(lit`conf.path.src('**/*.html')`);
} else {
conf.jspm.loadFiles.push(files);
}
}

Expand Down
7 changes: 7 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ module.exports = fountain.Base.extend({
'karma-chrome-launcher': '^0.2.3'
}
});
if (this.props.modules === 'systemjs') {
_.merge(pkg, {
devDependencies: {
glob: '^7.0.3'
}
});
}
} else {
_.merge(pkg, {
devDependencies: {
Expand Down

0 comments on commit 3213e61

Please sign in to comment.