You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
I wanted to keep unit testing files in separate folder out of app/, I wanted to keep the outside of app/ as spec/unit/app.spec.js, but its giving error as
/angular2-project/spec/unit/app.component.spec.js".
Chrome 54.0.2840 (Mac OS X 10.10.5): Executed 0 of 0 ERROR (0.006 secs / 0 secs)
Updated my karma.conf as var testBase = 'spec/unit/';
That was a problem! karma-test-shim couldn't handle more than one base path containing spec files.
I've updated karma-test-shim and karma.config accordingly. I made your use case work with the following changes
// karma-test-shim
...
// builtPaths: root paths for output ("built") files
// get from karma.config.js, then prefix with '/base/' (default is 'app/')
var builtPaths = (__karma__.config.builtPaths || ['app/'])
.map(function(p) { return '/base/'+p;});
...
// Is a "built" file if is JavaScript file in one of the "built" folders
function isBuiltFile(path) {
return isJsFile(path) &&
builtPaths.reduce(function(keep, bp) {
return keep || (path.substr(0, bp.length) === bp);
}, false);
}
...
// karma.config.js
var appBase = 'app/'; // transpiled app JS and map files
var appSrcBase = 'app/'; // app source TS files
var appAssets = 'base/app/'; // component assets fetched by Angular's compiler
var testingBase = 'spec/unit/'; // transpiled test JS and map files
var testingSrcBase = 'spec/unit/'; // test source TS files
...
client: {
builtPaths: [appSrcBase, testingBase], // add more spec base paths as needed
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
...
Activity
wardbell commentedon Nov 30, 2016
That was a problem!
karma-test-shimcouldn't handle more than one base path containing spec files.I've updated
karma-test-shimandkarma.configaccordingly. I made your use case work with the following changesAttached the working project in the following zip
issue-294-example.zip
The fundamental changes to
karma-test-shimandkarma.configis now in master as v.0.2.18chore: test framework improvements, remove tsconfig `exclude` clause
chore: test framework improvements, remove tsconfig `exclude` clause
chore(testing): karma config files support multiple builtPaths
chore(testing): karma config files support multiple builtPaths
chore(testing): karma config files support multiple builtPaths
chore(testing): karma config files support multiple builtPaths (#2917)