When I run ng test Karma opens Jasmine in Chrome with the following message:
Incomplete: No specs found
The Karma window looks like so:

My karma.conf.js is pretty standard:
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage/malbet'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
My src/test.ts file is also standard:
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
declare const require: any;
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
const context = require.context('./', true, /\.spec\.ts$/);
context.keys().map(context);
Is the error likely to be in these two configuration files or would it be a problem with how I introduce the tests in the component's xxx.spec.ts file?
I think I've got to the bottom of this. Jasmine was not getting far enough to run the tests because the build included a type error.
I had assumed that such an error would not cause Jasmine to give what looked like a failure. I suppose it did not get round to running any tests. Now that I have corrected the type error Jasmine is returning a list of unit test errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With