I'm trying to use Karma and Jasmine to test my Angular 7.2 application.
It works fine, except one thing : when I click on a test name, it's refreshing the page and re executing all the tests again. The same happen when there is a failure and I click to "Spec List". I though a click on the test name should redo only the clicked test(s) and "Spec List" click should only go to the list of Spec showing which are passing and which don't.
Any idea why ?
karma.conf.js :
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
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'),
require('karma-mocha-reporter')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/gts-ui-extensions-rc'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['mocha', 'kjhtml'],
port: 4300,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
dev dependencies :
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "~7.3.8",
"@angular/compiler": "^7.2.12",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "^7.2.12",
"@types/jasmine": "^3.3.12",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^11.13.0",
"codelyzer": "^5.0.0",
"jasmine-core": "^3.4.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.0.1",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-mocha-reporter": "^2.2.5",
"protractor": "^5.4.2",
"ts-node": "^8.0.3",
"tslint": "^5.15.0",
"typescript": "3.1.1",
"webpack": "^4.29.6"
}
Some script is redirecting the <a href='#'> </a>
links to the home page, while by default nothing should happen.
This problem is being addressed here: jasmine issues 1775
See the changes made to this pull request: pull request 1807
A temporary solution would be to apply the pull request 1807 changes to this file: node_modules\karma-jasmine-html-reporter\src\lib\html.jasmine.reporter.js
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