Closed tofagerl closed 7 years ago
I like what you have done here and I think that this is something that is needed, to have a nice way to test React projects (something that this template generates).
I'm not sure however if this should in the end should be something that should be part of the template, maybe this makes more sense as a plugin? What do you believe yourself from your perspective? Anyhow, I really like it it as an example/guide on how you can add things like this and test React code.
Good question... My view is that it depends on whether you think TDD is The One Solution to all life problems or not ;) And I do think that having tests out of the box in the 'demo' project is a Good Thing. You can look at it like a hint that the developer starting a new project should use tests, if you want. Nudge them in the right direction.
But that's all opinion. Practically it doesn't matter. As a plugin to the roc-template-web-app package it would do just about the same thing, but fewer would see it or use it. If I understand plugin correctly in this context, that is.
Edit: And either way it pushed me to learn about React testing, which was my main goal here :)
I think the tests are great and definitely should be part of the template, as a way to nudge the developer in the right direction as you say! :)
The only thing in my mind that this potential plugin would do is to make the custom action
and the direct dependencies not needed. But it might be that I'm looking at solving this in that way because we don't have a nice interface for doing this sort of things yet. There is a value that the end user can get an understanding on how to do something "custom" in a similar way.
This is worth some more thinking and maybe in the end this will be a natural part of the template, just with the new and improved interface for defining custom Webpack configuration.
Oh, I see your point. Yes, an Enzyme plugin. I've thought the same thing. The hook would need to do different things for React v15, by the way, and from what I can tell they're aiming for being fully compatible with webpack at some point, so for 16 it might be as simple as not needing a plugin.
I've been Out of Office this week. Might be some work gets done this weekend, depending on weather :)
Hey @tofagerl 👋
I guess you are not working on this branch anymore, but just wanted to let you know that we currently have a working Jest
integration via. https://github.com/rocjs/roc-plugin-test-jest
Can be checked out/demo'ed by saying Yes
to testing with Jest as highlighted in http://www.getroc.org/start/
roc init web-app-react wip
@andreasrs No, I changed job and moved to Java Backend :)
Ok. Good luck with the new job :) ☕️
Closing this one.
This test suite uses Enzyme and expect.js to test some basic things. Unit tests in progress, E2E tests coming later. So far only React-specific components tested. Reducer logic coming.
Not ready for merge, but very ready for comments.