Skip to content

Commit 4caec6f

Browse files
author
Fatme
authored
Merge pull request #4086 from NativeScript/fatme/fix-test-ng
fix(unit-testing): add correct files pattern in karma.conf.js when the project has nsconfig file
2 parents 447f42b + 7b42ac0 commit 4caec6f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/commands/test-init.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ class TestInitCommand implements ICommand {
105105
const frameworks = [frameworkToInstall].concat(this.karmaConfigAdditionalFrameworks[frameworkToInstall] || [])
106106
.map(fw => `'${fw}'`)
107107
.join(', ');
108+
const testFiles = `'${relativeTestsDir}/**/*.js'`;
108109
const karmaConfTemplate = this.$resources.readText('test/karma.conf.js');
109-
const karmaConf = _.template(karmaConfTemplate)({ frameworks });
110+
const karmaConf = _.template(karmaConfTemplate)({ frameworks, testFiles });
110111

111112
this.$fs.writeFile(path.join(projectDir, 'karma.conf.js'), karmaConf);
112113

resources/test/karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = function(config) {
1212

1313
// list of files / patterns to load in the browser
1414
files: [
15-
'app/**/*.js',
15+
${ testFiles }
1616
],
1717

1818

0 commit comments

Comments
 (0)