The Karama is a test runner and it use to writing
and running the unit tests while developing the application and Karma runs on Node.js.
Karma works on the node.js stable versions -
0.8.x, 0.10.x and 0.12.x.
Installing Karma and plugins - The recommended
approach to install Karma in your locally in the project's directory.
Install
Karma -
ü npm
install karma --save-dev
Install
plugins that your project needs -
ü npm
install karma-jasmine karma-chrome-launcher --save-dev
This will install karma, karma-jasmine and
karma-chrome-launcher packages into node_modules
in your current working directory and after installed save the all dependency
in the package.json file.
The
Command line Interface - You should install the Karma
CLI globally -
ü npm
install -g karma-cli
List of Karma Dependencies -
ü karma
ü karma-chrome-launcher
ü karma-cli
ü karma-coverage-istanbul-reporte
ü karma-jasmine
ü karma-jasmine-html-reporter
Install all above dependencies -
ü npm
install --save-dev <all-of-the-above-dependencies>
All the dependency
in the package.json looks like -
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
I hope you are enjoying with this post! Please
share with you friends!! Thank you!!!