ng-gen-unit-test

7.0.0 • Public • Published

Angular Test Generator


A tool to help you write unit tests in Angular. It parses the component file to scan through all functions and dependencies to inject. The CLI generated spec will be replaced by newer content that will have all it blocks generated for you with description already containing the name of the function. All dependencies in the constructor will be declared as spies and imported for you.

How to get started...

  1. Clone the repo using git clone
  2. Run npm install to install the necessary packages and then run npm install -g while inside the repo on your terminal to link the CLI.
  3. The command to run the generator is test-gen inside the test-gen repo, running it elsewhere will not work as of now.
  4. Your will see a colorful prompt saying Angular Test Generator and asking you to add the absolute path to the file for which you want to generate the tests.
  5. If the file is found, then the tool will overwrite the existing spec.ts file with newer content, i.e. it blocks with function names, imports and declarations and a success message in green will be displayed. If anything goes wrong, an error in red will be displayed.

To uninstall

Go to the repo and run npm uninstall -g to uninstall the tool.

Somethings to take care of..

  1. Sometimes the nodes are different, hence certain properties may be missing causing errors, in that case just let me know in the issues tab.
  2. Certain imports may not work, which can be imported automatically via VS Code, otherwise it should be good.

Readme

Keywords

none

Package Sidebar

Install

npm i ng-gen-unit-test

Weekly Downloads

0

Version

7.0.0

License

MIT

Unpacked Size

19.3 kB

Total Files

5

Last publish

Collaborators

  • asrih