I am using angular cli version 1.4.5 and below is the karma.conf.ts file
module.exports = function (config) { config.set({ basePath: \'\', exclude: [
Change the config in the src/test.ts.
src/test.ts
const context = require.context('./', true, /\.spec\.ts$/);
https://github.com/angular/angular-cli/issues/9026#issuecomment-354475734