percyhanna / rquery

A testing utility that provides React tree traversal similar to jQuery
MIT License
56 stars 9 forks source link

Difficulty initializing from Travis CI #34

Closed jwentz-boc closed 8 years ago

jwentz-boc commented 8 years ago

rquery works fine in my local dev environment, karma and webpack (and is very helpful, thx!). However when I try to run the tests under Travis (continuous integration service) I see the following error.

22 03 2016 14:00:48.500:DEBUG [web-server]: serving (cached): /home/travis/build/betteroutcomes/boc-pro/tests.webpack.js
  Uncaught TypeError: Cannot read property 'TestUtils' of undefined
  at /home/travis/build/betteroutcomes/boc-pro/tests.webpack.js:37072

It seems, looking at the source, that this line is failing:

https://github.com/percyhanna/rquery/blob/master/rquery.js#L13

I added some logs to the test, to try to understand the initialization better:

var React= require('react');
var ReactDOM = require('react-dom');
var TestUtils = require('react-addons-test-utils');
var _ = require('lodash');
console.log(typeof require);
console.log(typeof exports);
console.log(typeof module);
var $R = require('rquery')(_, React, ReactDOM, TestUtils);

but the result doesn't help explain what is going on:

Chromium 45.0.2454 (Ubuntu 0.0.0) LOG: 'function' 
Chromium 45.0.2454 (Ubuntu 0.0.0) LOG: 'object'
Chromium 45.0.2454 (Ubuntu 0.0.0) LOG: 'object'
Chromium 45.0.2454 (Ubuntu 0.0.0) ERROR
  Uncaught TypeError: Cannot read property 'TestUtils' of undefined    
    at /home/travis/build/betteroutcomes/boc-pro/tests.webpack.js:37072 

Any suggestions as to what might be the problem? (Thanks in advance)

percyhanna commented 8 years ago

My best guess is that Travis is installing a different version of React than you are using locally. Perhaps it's installing a v0.15 RC? Using shrink wrap might solve this problem. I haven't worked on adding v0.15 support yet.

jwentz-boc commented 8 years ago

thx for the speedy reply…..I don’t think 0.15 is the problem, I’m actually running npm install to setup the node env for travis:

npm list shows..

├── react-dom@0.14.7

’Tis a bit confusing…

On Mar 22, 2016, at 10:49 AM, Andrew Hanna notifications@github.com wrote:

My best guess is that Travis is installing a different version of React than you are using locally. Perhaps it's installing a v0.15 RC? Using shrink wrap might solve this problem. I haven't worked on adding v0.15 support yet.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/percyhanna/rquery/issues/34#issuecomment-199849435

percyhanna commented 8 years ago

I'm wondering if this was caused by the issue described in #35? Can you try again and see if it's working now?

jwentz-boc commented 8 years ago

Indeed, I can confirm that fixed the problem.

Thanks, both for rquery itself and for the fix!

cheers /j

percyhanna commented 8 years ago

:beers: