Automates creation of initial unit test files taking dependencies into account.
Supported types:
- component: source, generated spec, generated spec with custom handler
- directive
- service: source, generated spec
- service (double quote): source, generated spec
- pipe
- class file (may not be useful depending on use case)
Basic input/output example:
With custom event bus service dependency handler:
run npm i jasmine-unit-test-generator
run jasmine-unit-test-generator <path-to-file>
run jasmine-unit-test-generator --handlers <path-to-handlers-dir> <path-to-file>
install ts-node
run jasmine-unit-test-generator --require ts-node/register --handlers <path-to-handlers-dir> <path-to-file>
At the moment argument order is important!
And note that if you install generator globally, ts-node must be installed globally as well. Otherwise both need to be installed locally in the project.
You can extend formatting of resulting spec files for each dependency by making a dependency handler. See default-dependency-handler.ts and event-bus.service.handler.ts
It is possible to add extra declarations, initializers and dependencies.
It's probably best to:
- add an input file in
spec/fixtures
folder, e.g. test.ts - add expected output file, e.g. test.spec.expected.ts
- link them in integration.spec.ts
Alternavely, you can:
- run
npm link
- run
npm run build:dev
- run
jasmine-unit-test-generator <option>
in your project of choice
run npm run build
run npm publish