Install jsTestDriver plugin for IntelliJ
Ensure that the following files exist within your project
- jquery-1.8.3.js
- jasmine-1.1.0.js *
- JasmineAdapter-1.1.2.js *
- angular-resource.js
- angular-mocks.js
Create a .jstd file in your project folder.(eg ‘TestConfig.jstd’).The file should be something like this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load: | |
- path/to/jquery-1.8.3.js | |
- path/to/jasmine-1.1.0.js | |
- path/to/JasmineAdapter-1.1.2.js | |
- path/to/angular.js | |
- path/to/angular-resource.js | |
- path/to/angular-mocks.js | |
- path/to/app,models and controllers | |
test: | |
- path/to/testfile.js |
Create a test file. Write your test cases using Jasmine and run them using JsTestDriver plugin.
Note: if u add angular-mocks.js before jasmine, on running the tests, you may get a reference error - module/inject not defined
* while writing the test cases, IntelliJ prompts to add JasmineAdapter and jasmine you could add them then as well