-
Notifications
You must be signed in to change notification settings - Fork 518
In templates, add option to generate unit tests #304
Comments
The karma-testing-example was extremely helpful in setting up unit tests, thank you. Karma does start, however, Jasmine's definitions can't be found, even though we added @types/jasmine and @types/karma-jasmine. Please could you provide some much needed guidance! Screenshot of the package.json that was used: |
@EduardTheThird Do you have |
Hi @MarkPieszak Thank you for the suggestion, I've added noResolve to karma.config.js and unfortunately, the same errors persisted. I've tried setting it to both true and false. Please find below the karma.config.js, it is the same as the karma-testing-example: For reference, this is the unit test spec used, both Jasmine "expect" and Chai "assert" markup returns the same error: Did the way unit test's get setup change with Angular 2 final, as I suspect the "ReferenceError: exports is not defined" error might be the culprit. |
This is now implemented. If you get the latest FEEDBACK REQUESTED For anyone familiar with good unit test practices in Angular 2 (@MarkPieszak?), do the contents of |
@SteveSandersonMS Let me take a look tomorrow morning and I'll get back to you! |
I can confirm that unit tests are working now! Thank you @SteveSandersonMS 😸 |
@SteveSandersonMS Sorry for the delay, been swamped, but everything looks great from this end! TestBed is indeed the ideal way to test a Component in a more realistic environment. 👍 💯 |
Original request was #87, with comments:
@on3al commented:
These templates are extremely helpful for getting started, but I'm at a loss how to fit unit testing into this workflow. Could someone please look into adding a working sample of a unit test using jasmine/karma? A jasmine test page in addition to the index page on the home controller that updates as changes occur during development would be great.
@laskoviymishka commented:
Good point, this issue related to #9.
A jasmine test page in controller IMHO is not quite good, it better to run your tests from CLI via something like karma. But option to add unit tests should be presented in yo generator definetely
The text was updated successfully, but these errors were encountered: