-
Notifications
You must be signed in to change notification settings - Fork 74
Karma + Jasmine test runner #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Uses the new react-transform for hot-reloading: https://github.com/gaearon/babel-plugin-react-transform Note, transform does nothing when `process.env.NODE_ENV` is set to `’production’`. - removes react-hot-loader - moves es stage settings to .babelrc - adds react-transform settings to .babelrc
makes errors very nice to deal with, shows a red error container over your app window, much like React native. https://github.com/gaearon/react-transform-catch-errors https://github.com/KeywordBrain/redbox-react
Oh btw, if you add all of these PRs this one is after react-transform and would conflict if applied before that (I think). |
); | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, any way we could make the test have something to do with what's actually in the App stub instead of this?
Yea we could either add a react component that doesn't have meteor and the react mixin or stub them out in the test. There happens to be a lot going on in there.... mixin, collections. Normally I just use slim controller-views and cover those with acceptance tests, then their children are stateless and are easy to unit test with minimal/no stubbing/mocking. Either way would be fine with me, let me know. |
Another thought.... we could make the contents of app a component that takes props (the X users X posts bit). I think that would also help guide people down the path of using the MeteorMixin in a maintainable way as well. And/Or we could have an 'Add Post' button that increments the posts number. I think that would be an improvement over the unused component above. |
@AdamBrodzinski I mean, the goal for the main branch was not to have much placeholder code for users to delete, right? :) |
Lol yep, that's why I just added the un-used component in line since these will all be blown out anyway. We could even add unit-tests to another branch if that's not something that you think people will use. |
How about this: let's just test that various Meteor and React globals are available and working. It would be nice for a test to prove this app skeleton provides what it says it does |
Yea i'll try but I think those globals will be undefined though since it's not a full integration test. |
Oh. There's a way to do integration tests with Karma right? |
Yes and no... Velocity makes this turn key and is way easier. It's using Karma itself but in another weird way that ties in with Meteor closely. Velocity also has unit tests but they're dog slow due to the meteor build system. Luckily running this way outside of Meteor is lightning fast. Velocity's acceptance tests were always brittle for me so i'm just using Capybara instead which also uses a much nicer DSL. Speaking of I have to figure out how to symlink |
Yup, |
Just a heads up I won't be able to add anything else to this for quite some time, i'm really swamped. I might be able to do a separate PR for integration tests using velocity (symlinking) later. |
No worries, I'll just go ahead and merge this then. I realize, since there is some code one has to delete from this project any way to start fresh, it's not really a change in philosophy to integrate these tests (plus Tomit was looking for them) Sorry for being OCD at times... Once I have the new Webpack plugin approach worked out, it would be a lot easier to maintain your own skeleton project exactly to your liking :) You've always been more focused on teaching other people, which is great, I've been mostly focused on the getting the basics of using Meteor and Webpack together just right. |
Karma + Jasmine test runner
👍 Being OCD about it is a good thing... don't want it to be grow into a tangled mess 😆 Thanks! I've found that making things easy to use (by great docs/comments) and having screenshots makes your # of stars/users go way up. |
Adds the karma / webpack config with a basic passing spec. Uses Jasmine but can easily be changed to Mocha, Tape, etc... (commented out karma-mocha added). Adds Chrome launcher. Copies over the client webpack config settings and omits some too.
helper files are stored in ./test. It's a bit empty now but I was going to use that to symlink integration test folders into
meteor_core
later.