Run
1. HelloWorld.js
- There is a HelloWorld.js in app folder
2. HelloWorldSpec.js
- HelloWorldSpec.js will be located in tests folder
3. Karma start
- karma start
'Tools > karma' 카테고리의 다른 글
[Karma] Karma (0) | 2016.07.29 |
---|
Run
1. HelloWorld.js
- There is a HelloWorld.js in app folder
2. HelloWorldSpec.js
- HelloWorldSpec.js will be located in tests folder
3. Karma start
- karma start
[Karma] Karma (0) | 2016.07.29 |
---|
Karma
1. What's that?
- Karma is a test runner provided by the Angular team
- Karma will execute your tests in multiple browsers which shall ensure that our application is compatible in all browser
2. How to set up
0) Install AngularJs
npm install angular --save
1) Install Karma
npm install -g karma --save-dev
2) Install Jasmine
npm install karma-jasmine jasmine-core --save-dev
If you are using npm v3.x you might face some problems while running karma start
jasmine-core is required to be installed globally
npm install jasmine-core -g
3) Install ngMock
- ngMock allows you to inject and mock angular services to help you test your application
npm install angular-mocks --save-dev
3) Browsers
- Install browser launcher on which you want karma to run your tests
- We need to install at least one browser
npm install karma-chrome-launcher --save-dev
4) Create two folders in your working directory
- app : Your script files
- tests: here we will keep our tests
5) karma.conf.js
- karma init
- Open up your karma.conf.js and add the location of angular.js in to the files array
node_modules/angular/angular.js
- Add the location for ngMock just below that
node_modules/angular-mocks/angular-mocks.js
[Karma] Run (0) | 2016.07.29 |
---|