{"id":22733561,"url":"https://github.com/burdiuz/webstorm-angular-unittest-templates","last_synced_at":"2026-04-09T23:05:10.897Z","repository":{"id":35093788,"uuid":"39258014","full_name":"burdiuz/webstorm-angular-unittest-templates","owner":"burdiuz","description":"File templates for WebStorm using Angular.JS","archived":false,"fork":false,"pushed_at":"2015-12-10T09:46:12.000Z","size":560,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T01:45:39.521Z","etag":null,"topics":["angular","angularjs","jasmine","jetbrains","karma","karma-jasmine","mocha","template-webstorm","templates","unit-testing","webstorm"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Ontraport/Backend-Test","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/burdiuz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-17T14:25:40.000Z","updated_at":"2020-08-13T21:30:54.000Z","dependencies_parsed_at":"2022-08-04T00:00:14.930Z","dependency_job_id":null,"html_url":"https://github.com/burdiuz/webstorm-angular-unittest-templates","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/burdiuz/webstorm-angular-unittest-templates","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burdiuz%2Fwebstorm-angular-unittest-templates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burdiuz%2Fwebstorm-angular-unittest-templates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burdiuz%2Fwebstorm-angular-unittest-templates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burdiuz%2Fwebstorm-angular-unittest-templates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/burdiuz","download_url":"https://codeload.github.com/burdiuz/webstorm-angular-unittest-templates/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/burdiuz%2Fwebstorm-angular-unittest-templates/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268697254,"owners_count":24292394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angularjs","jasmine","jetbrains","karma","karma-jasmine","mocha","template-webstorm","templates","unit-testing","webstorm"],"created_at":"2024-12-10T20:14:59.536Z","updated_at":"2025-10-05T15:02:48.208Z","avatar_url":"https://github.com/burdiuz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webstorm-angular-unittest-templates\nWebStorm file templates for unit-testing of applications based on [AngularJS](https://angularjs.org/). This set of templates for controllers, directives and services is designed to minimize time needed to expand environment when new test cases should be created. There are two types of templates\n\n - Extended -- full list of mocks/tools I use often in testing, after creating new test, there probably will be something to remove.\n - Simple -- lightweight template with things that needed most in testing, usually nothing removed and lots added.\n\nEverything you need is in `/bin/` folder, or `/1.3/` if you want to check templates code. I'm using these templates for application that was built with AngularJS 1.3, but this does not mean you cannot use it with any version of AngularJS. Some tweeking might be required, also [#self-tests](#self-tests)  might come handy.\n\n\u003e **Note:** Templates do not contain framework-specific code(there are no assertions defined), so should work fine with most test frameworks. Currently [Jasmine](http://jasmine.github.io/) and [Mocha](http://mochajs.org/) tested.\n\n## Contents\nThis repo includes WebStorm templates in `1.3/` folder for [AngularJS](https://angularjs.org/) 1.3 unit-testing and test project, that was covered with unit-tests using these templates. Currently in use two Karma configs for [Mocha](http://mochajs.org/) + [Chai](http://chaijs.com/) + [Sinon.JS](http://sinonjs.org/) and [Jasmine](http://jasmine.github.io/) testing frameworks.\n`tests/1.3` folder contains  \n\n - `/src` -- test project that should be covered with unit-tests\n - `/mocha` -- Unit-tests written using Mocha + Chai + Sinon.JS frameworks.\n\t - `mocha/simple` -- simple templates used for testing project\n\t - `mocha/extended` -- extended templates used for testing project\n - `jasmine` -- Unit-tests written using Jasmine framework, has same folders inside, as `/mocha/*`.\n\n## Install\nTo add templates to your WebStorm, [do these steps](https://www.jetbrains.com/webstorm/help/exporting-and-importing-settings.html):\n\n1. Download [JAR archive with templates](https://raw.githubusercontent.com/burdiuz/webstorm-angular-unittest-templates/master/bin/unittest_templates_angular13.jar)\n2. Open WebStorm\n3. File \u003e Import Settings\n4. In the \"Import File Location\" dialog box that opens, select downloaded archive\n5. In the \"Select Components to Import\" dialog box that opens, specify \"File Templates\" to be imported, and click OK\n\n\u003e**Note:** This will add all available templates to your WebStorm File \u003e New menu. You can remove unused or change them in \"File and Code Templates\" settings panel.\n\nAlternatively you can add templates by hand using \"File and Code Templates\" settings panel.\n\n1. Open WebStorm\n2. File \u003e Settings... (Ctrl+Alt+S) \u003e Editor \u003e File and Code Templates\n3. Select \"Templates\" tab\n4. Click on green plus button\n5. Specify name of your template, extension to be \"js\"\n6. Copy-paste code from file template\n7. Apply\n\n\u003e **Note:** After adding templates you can create new files from templates via File \u003e New... (Alt+Insert) menu or context \"New\" menu of Project panel.\n![Templates in New File context menu](images/webstorm_new_file.png)\n\n## Parameters\nWhen creating new file from template WebStorm will ask you for file name and additional information:\n![Use Controller Extended Unit-tests template](images/controller_extended.png)\n\u003e#### Controller\n - Module name -- angular module of controller\n - Controller name -- controller name in angular  \n\n\u003e#### Directive\n - Module name -- angular module of controller\n - Directive HTML name - directive HTML name, the one with dashes  \n\n\u003e#### Service\n - Module name -- angular module of controller\n - Service name -- service name registered in angular\n \nExtended template for controller, directive and service supports optional parameters  \n\n\u003e - Test category -- 1st nesting level for test cases, if not specified, angular module will be used as test category\n\u003e - Test description -- 2nd nesting level for test cases, if not specified, specified name of controller/directive/service will be used as test description   \n\n![Categories and Descriptions in WebStorm](images/test_categories.png)\n \n## #self-tests\nThis is simple test cases to test created environment, they may be used to know if environment was created properly. Just insert them into templates and run after new file from template was created. After first successful run #self-test can be removed.\n### Jasmine\n\u003e#### Controller\n ```javascript\n      it('#self-test', function() {\n        expect(${DS}scope).toBeTruthy();\n        expect(controller).toBeTruthy();\n      });\n ```\n\u003e#### Directive\n ```javascript\n      it('#self-test', function() {\n        expect(${DS}parentScope).toBeTruthy();\n        expect(element).toBeTruthy();\n        expect(controller).toBeTruthy();\n        expect(${DS}scope).toBeTruthy();\n      });\n ```\n\u003e#### Service\n ```javascript\n      it('#self-test', function() {\n        expect(service).toBeTruthy();\n      });\n ```\n \n### Chai\n\u003e#### Controller\n ```javascript\n      it('#self-test', function() {\n        expect(${DS}scope).to.be.ok;\n        expect(controller).to.be.ok;\n      });\n ```\n\u003e#### Directive\n ```javascript\n      it('#self-test', function() {\n        expect(${DS}parentScope).to.be.ok;\n        expect(element).to.be.ok;\n        expect(controller).to.be.ok;\n        expect(${DS}scope).to.be.ok;\n      });\n ```\n\u003e#### Service\n ```javascript\n      it('#self-test', function() {\n        expect(service).to.be.ok;\n      });\n ```  \n\n## Links  \n\n[AngularJS WebStorm live templates](https://github.com/angularjs-livetpls/angularjs-webstorm-livetpls)  \n\n[An Introduction To Unit Testing In AngularJS Applications](http://www.smashingmagazine.com/2014/10/introduction-to-unit-testing-in-angularjs/)  \n\n\u003e Written with [StackEdit](https://stackedit.io/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburdiuz%2Fwebstorm-angular-unittest-templates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fburdiuz%2Fwebstorm-angular-unittest-templates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburdiuz%2Fwebstorm-angular-unittest-templates/lists"}