https://github.com/survi218/karma-jasmine-testing
unit testing in your Angular applications using Angular mocks, Karma, and Jasmine
https://github.com/survi218/karma-jasmine-testing
angularjs jasmine-tests jasmine-tests-angularjs karma-cli karma-config karma-jasmine karma-preprocessor karma-test-runner unit-testing
Last synced: 2 months ago
JSON representation
unit testing in your Angular applications using Angular mocks, Karma, and Jasmine
- Host: GitHub
- URL: https://github.com/survi218/karma-jasmine-testing
- Owner: survi218
- Created: 2017-05-28T03:48:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-28T06:14:14.000Z (almost 8 years ago)
- Last Synced: 2025-03-05T21:57:37.957Z (3 months ago)
- Topics: angularjs, jasmine-tests, jasmine-tests-angularjs, karma-cli, karma-config, karma-jasmine, karma-preprocessor, karma-test-runner, unit-testing
- Language: HTML
- Homepage:
- Size: 34.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# karma-jasmine-testing
- unit testing in your Angular applications. You will learn about Angular mocks, Karma, and Jasmine and learn how to use them to carry out unit testing and e2e testing.
- Configure a Karma configuration file and Set up unit tests using Jasmine and carry out the unit test automatically
- Setting up the Unit Test Environment
- First, set up Jasmine core to be available for use within your project:# install karma and karma-jasmine
```````
npm install karma --save-dev
npm install jasmine-core --save-dev
````````
- Then, set up the Karma command line tools globally as follows:``````
npm install karma-cli -g
``````Remember to use sudo if you are in OSX or Linux environments.
Then set up karma-jasmine plugin to make use of Jasmine with Karma:
``````````
npm install karma-jasmine --save-dev
````````````
- In order to set up browser environments to carry out the tests, set up PhantomJS, and Karma launchers for PhantomJS and Chrome as follows:````````
npm install phantomjs karma-phantomjs-launcher karma-chrome-launcher karma-edge-launcher --save-dev
``````````- You can also set up for Firefox, IE and Safari if you use these browsers.
Setting up Angular Mocks
You should also install the ngMock module as follows:``````````
bower install angular-mocks -S
``````````````
Unit Testing of MenuController
Next, we will configure Karma to conduct the unit test. First, create a folder in conFusion folder, named test.
Move to the test folder, and create a file named karma.conf.js there. This file will contain the configuration information for the Karma tests.