AngularJS Jasmine test generator
This is a simple CLI application to facilitate the creation of Jasmine test for AngularJS
Instalation
Via git:
git clone git+https://github.com/LuisEGR/angularjs-test-generator.gitcd angularjs-test-generatornpm install -g
Vía npm:
npm install -g angularjs-test-generator
Use
Simply go to the directory of your component, which must have these files:
- ./module.js *
- ./controller.js *
- ./view.html
and at least one of this:
- ./directive.js
- ./component.js
cd myApp/components/my-component/gentest
this will create the file component.spec.js
CLI Arguments
argument | defualt | description | example |
---|---|---|---|
-o |
component.spec.js |
destination file | gentest -o spec/myout.spec.js |
Attention!
This script requires you to have your project with this configuration:
- Webpack module builder
- ES6 Project, with ES6 modules (babel-preset-env^)
- Karma test runner
TODO
- Components
- module name from
module.js
- htmlTag -> html-tag from
folder-name
- controller functions (starting with vm.) from
controller.js
- bindings ('<', '&', '@') from
component.js
- templateCache on
view.html
- testData on
fixtures.js
- module name from
- Directives -> Element, Attribute
- Filters
- Services
If you have any problem with this script please open a new issue describing the problem and how to replicate it.