-
Notifications
You must be signed in to change notification settings - Fork 4
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
ch08 TweetUtils es2015 module export failing test #1
Comments
Hi, thanks for the comment. Just to confirm, you have cloned this repo, cd'd into the ch08 directory, and run If so, I can't reproduce the issue (see image below). If not, please try doing that and seeing whether the tests still fail. Thanks again. |
Thanks for the reply. You got me, I'm actually not running exactly the same config. I'm using webpack but in the rest of the code things run fine as es2015 modules which is what's foxing me. In the tests I'm using babel, jest and babel-jest on the command line so webpack isn't in the mix there. I'll try cloning as you suggest, maybe something will pop out as obviously different. Many thanks. |
So a clone of that passes the utils test but fails the component tests with the same object undefined error. ch08/node_modules/react/lib/BeforeInputEventPlugin.js: Cannot read property 'topCompositionEnd' of undefined A little googling turned up facebook/react#5183 and I'm running npm 3 !!Upgrading jest-cli past v0.9 solves the npm3 issue on auto mocking. I'm on 0.9.2 for reference. That's not my original issue of course. I'll try to focus on that tomorrow. Thanks again for your help. |
Okay, thanks. I wouldn't be terribly surprised if your original issue also traces back ultimately to jest and/or your npm version. Maybe you can try what's mentioned in facebook/react-native#3999 (comment) and let me know if that gets things working for you? Unfortunately, jest is still very much a black box, so it might take some trial and error. |
Yeah, having read up on it a bit more, I'm almost certain that that comment in my last post contains the solution to your issue. There was a major change between Babel 5 and Babel 6 involving the way that Please let me know if that resolves this particular issue for you, and also what version of jest/babel-jest you are using, if you don't mind. |
Spot on Jason. I really appreciate your support here. Babel 5>6 has tripped me up a few times but it's forced me to understand why and learn. Here's the dependencies section from my package.json. jest 0.10 and jest-babel 10.0.1 I played with webpack-babel-jest but not got that working yet but my jest:{} setup in package.json only refers to babel-jest. "devDependencies": {
"babel-cli": "^6.6.5",
"babel-core": "^6.7.2",
"babel-jest": "^10.0.1",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-cssnano": "^2.1.1",
"gulp-plumber": "^1.1.0",
"gulp-sass": "^2.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-watch": "^4.3.5",
"gulp-webpack": "^1.5.0",
"jest-cli": "^0.10.0",
"webpack": "^1.12.14",
"webpack-babel-jest": "^1.0.4",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"react": "^0.14.8",
"react-dom": "^0.14.8",
"snapkite-stream-client": "^1.0.3"
}, |
Hey, no problem! Glad we were able to locate the source of the problem. Thanks for the additional info, too; the version of babel-jest you're using does indeed depend on Babel 6, so that seems to be the source of the test failure. In order to keep things here compatible with both Babel 5 and Babel 6, I suppose I could have the tests check for the presence of a |
Will check. Initial test with rebase to that branch, unaltered package.json but npm 3 it fell apart. I need to work out which modules to upgrade. I'm concerned though that whereas you may get compatibility across jest-cli & babel-jest the version of npm will be rather more difficult... Maybe a better approach would be two branches with the alt branch assuming npm 3? Not sure. Long day here and only just had a quick look. I'll give it more time very soon. |
@stevegibbings Any updates? I've kind of let this slip my mind and only just remembered that we never went any further after your last comment. Instead of trying to rebase with the branch I mentioned, it might be easier for you to just incorporate the changes in the diff at https://github.com/jmrog/react-essentials-es6-version/compare/babel-6-compat into your own configuration and see if that gets you past the errors. I think it ought to. That will tell us that we've definitely located the issues with those tests in relation to Babel 6. If there are additional issues with npm 3, that could be a separate issue worth investigating. |
@jmrog Sorry I've not been able to put the time in to look at this. I will at the weekend and get back to you. |
@jmrog sorry this took longer to get around to. I tried the babel-6-compat branch - npm 2.15.3 all 4 tests pass I tried npm 2.15.3 and jest-cli 0.10.2 and all tests pass, so for complete compatibility I'd say use jest-cli 0.10.2 in the branch as that works with the later jest-cli and npm 2 & 3. I went back to my webpack config and with the updated utils and components folders copied in all 4 tests pass there too. Obviously that config is quite different though. |
Hi,
First thanks for the es2015 version of these files. Using your version of TweetUtils.js the test fail with "TypeError: TweetUtils.getListOfTweetIds is not a function".
If I change the export to commonJS format the test pass.
Any ideas? Do your tests run OK?
The text was updated successfully, but these errors were encountered: