ng-gen-unit-test
v7.0.0
Published
Automatic test generation for Angular projects
Downloads
10
Readme
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...
- Clone the repo using
git clone
- Run
npm install
to install the necessary packages and then runnpm install -g
while inside the repo on your terminal to link the CLI. - The command to run the generator is
test-gen
inside the test-gen repo, running it elsewhere will not work as of now. - 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.
- 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..
- Sometimes the nodes are different, hence certain properties may be missing causing errors, in that case just let me know in the issues tab.
- Certain imports may not work, which can be imported automatically via VS Code, otherwise it should be good.