When I run ng test, it goes through all test files.
I found an answer, by running the providing the path of the file:
ng test --main src/app/pages/home-modal/home-modal.component.spec.ts
on stackoverflow but I guess it was deprecated and I received this error:
AsyncTestZoneSpec is needed for the async()
Here is my karma.config.ts file:
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 // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
Does anyone know the new way of running a specific file in Karma for Angular 4+?
Aucun commentaire:
Enregistrer un commentaire