Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Migrate to Karma for testing #240

Merged
merged 12 commits into from
Jul 7, 2015
Merged

Migrate to Karma for testing #240

merged 12 commits into from
Jul 7, 2015

Conversation

exogen
Copy link
Contributor

@exogen exogen commented Jul 3, 2015

  • Translate Jest assertions and spies to Chai/Sinon.
  • Use inject-loader for mocking require()'d dependencies. I tried both karma-commonjs-plus and mockery and couldn't get either of them to work after much debugging and fiddling around. inject-loader's API is quite unwieldy, but it's the only one that worked.
  • Fixes up the flow type annotation syntax in two modules; the trailing commas were causing an error to be thrown during transformation, not sure why.
  • Remove all references to Jest
  • Add Node 0.12 back to the Travis config
  • I made a point to keep all the babel dependency versions the same, so I'm not sure why the dist files changed slightly.

fixes #225

- Use `inject-loader` for mocking `require()`'d dependencies. I tried both `karma-commonjs-plus` and `mockery` and couldn't get either of them to work after much debugging and fiddling around. `inject-loader`'s API is quite unwieldy, but it's the only one that worked.
- Fixes up the flow type annotation syntax in two modules; the trailing commas were causing an error to be thrown during transformation, not sure why.
- Remove all references to Jest
- Add Node 0.12 back to the Travis config
- I made a point to keep all the `babel` dependency versions the same, so I'm not sure why the `dist` files changed slightly.

fixes #225
@@ -23,7 +23,7 @@ module.exports = {
module: {
loaders: [
{
test: /\.js(x|)?$/,
test: /\.js(x|)$/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would /\.jsx?$/ work and be cleaner?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I was tempted to change it to that – actually I didn't want to modify this file at all to keep the diff smaller; this change is a mistake. But I'll change it to that so the syntax matches what's in karma.conf.js.

The loader here is bugging me too; in the Karma config it's babel?stage=1 and here it's babel-loader?stage=0. The former syntax is what I'm seeing recommended in documentation everywhere, do you know why this is different?

@ianobermiller
Copy link
Contributor

Wow nicely done! Please revert the dist files, we only generate them when
tagging releases.

On Thu, Jul 2, 2015 at 5:58 PM Brian Beck notifications@github.com wrote:

  • Translate Jest assertions and spies to Chai/Sinon.
  • Use inject-loader for mocking require()'d dependencies. I tried both
    karma-commonjs-plus and mockery and couldn't get either of them to
    work after much debugging and fiddling around. inject-loader's API is
    quite unwieldy, but it's the only one that worked.
  • Fixes up the flow type annotation syntax in two modules; the
    trailing commas were causing an error to be thrown during transformation,
    not sure why.
  • Remove all references to Jest
  • Add Node 0.12 back to the Travis config
  • I made a point to keep all the babel dependency versions the same,
    so I'm not sure why the dist files changed slightly.

fixes #225 #225

You can view, comment on, or merge this pull request online at:

#240
Commit Summary

  • Migrate to Karma for testing

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#240.

@ryan-roemer
Copy link
Member

Appveyor's failing (https://ci.appveyor.com/project/ryan-roemer/radium/build/1.0.118) and this seems familiar. Probably related, Karma has historically been wonky with installing internal deps on practically all CI systems.

We can try kicking Appveyor, but in addition we can consider a few extra hacks I have here for a Karma CI build https://github.com/FormidableLabs/full-stack-testing/blob/master/appveyor.yml

@ryan-roemer
Copy link
Member

OK. I've kicked Appveyor. Let's watch build https://ci.appveyor.com/project/ryan-roemer/radium/build/1.0.119

expect(Prefixer.cssPrefix).toBe('-moz-');
expect(Prefixer.jsPrefix).toBe('Moz');
var Prefixer = require('inject!prefixer.js')({'exenv': exenv});
expect(Prefixer.cssPrefix).to.equal('-moz-');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future comment: You'll get more informative assertion failures with something like:

expect(Prefixer).to.have.property('cssPrefix', '-moz-');

... but I don't want to clog up a straight porting PR with change suggestions ;)

@ryan-roemer
Copy link
Member

@exogen -- Great work! And nice to see v0.12 enabled on both Travis and AppVeyor.

I'll leave you to @ianobermiller and @alexlande for the rest of the substantive approval here...

@exogen
Copy link
Contributor Author

exogen commented Jul 7, 2015

Thanks for the assertion tips, @ryan-roemer – I'll open a separate issue to track those once this PR is merged.

# Radium Ticket: https://github.com/FormidableLabs/radium/issues/138
# Upstream Jest Ticket: https://github.com/facebook/jest/issues/243
#- 0.12
- 0.12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add an io.js build in here as well?

- Remove Stylus file processor
- Add latest stable io.js to Travis config
@exogen
Copy link
Contributor Author

exogen commented Jul 7, 2015

Added "iojs" to the Travis config, which will pick up the latest stable release. For Appveyor, the docs say this will pick up io.js: - nodejs_version: "1.0" which seems a bit sketch to me (just the version number differentiating the runtime). Should we add it there too anyway?

@ianobermiller
Copy link
Contributor

I don't see why not. Can always change it back if there are issues.
On Tue, Jul 7, 2015 at 6:32 PM Brian Beck notifications@github.com wrote:

Added "iojs" to the Travis config, which will pick up the latest stable
release. For Appveyor, the docs say this will pick up io.js: -
nodejs_version: "1.0" which seems a bit sketch to me (just the version
number differentiating the runtime). Should we add it there too anyway?


Reply to this email directly or view it on GitHub
#240 (comment)
.

@ianobermiller
Copy link
Contributor

Awesome work @exogen, thank you!

ianobermiller added a commit that referenced this pull request Jul 7, 2015
@ianobermiller ianobermiller merged commit a70ed25 into master Jul 7, 2015
@ianobermiller ianobermiller deleted the migrate-to-karma branch July 21, 2015 21:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move tests from jest to karma
3 participants