Shallow-render should now support both Jest & Jasmine #100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Should fix #99
Couple of points:
There's a note about being type safe with public contracts - I wanted to add, that the implementations for wrapping jest & jasmine are now using
any
in more places than I'd like. Since it's used internally, I could settle with it, but in the current implementation this is exposed as a public static property on theShallow
class, so it's available for consumers of this library. I wanted to avoid installing packages that'd help with the typings, but I can see that as an option.Test coverage - I have added exactly 0 tests for these changes, since I've found it difficult to test for global objects/namespaces. Also, in the library itself, there's nothing at the moment ensuring that tests run with jest (I did test it on the example that I've attached in Adding jest support #99 though). The only way I can think of is to set up sample projects that use different testing frameworks.
I think I explicitly went against "No funny business" with the way I'm trying to determine if jest is available or not, although I'd let you be the judge of that. I've checked
ts-mockery
(as suggested in Adding jest support #99 ) and that package seems to accept a configuration for which test runner to use. I'm being selfish, and I know I wouldn't want to set that up withshallow-render
if it can be avoided, but not sure if the current implementation is better than allowing external configuration.Tried to come up with an implementation that's somewhat in line with https://github.com/getsaf/shallow-render/projects/1#card-18903827 - not sure how well I did on that