Skip to content
This repository has been archived by the owner on Sep 11, 2018. It is now read-only.

Can't run test with fbjs 0.8.0 #697

Closed
Freddy03h opened this issue Apr 6, 2016 · 2 comments
Closed

Can't run test with fbjs 0.8.0 #697

Freddy03h opened this issue Apr 6, 2016 · 2 comments

Comments

@Freddy03h
Copy link

Issue

Hello, I installed Draft.js on my project, a Rich Text Editor by Facebook : https://facebook.github.io/draft-js/
And this project has the particularity to be dependent of fbjs@0.8.0-alpha.2

And since, test doesn't run anymore, when I npm run test, I've got the following error :

START:
06 04 2016 17:53:21.039:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
06 04 2016 17:53:21.071:INFO [launcher]: Starting browser PhantomJS
06 04 2016 17:53:22.960:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on socket /#gba2WCoQqyELMJKhAAAA with id 86581400
PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  TypeError: undefined is not a constructor (evaluating 'query.startsWith(name)')
  at /Users/freddy/Desktop/react-redux-starter-kit/tests/test-bundler.js:91609 <- webpack:///~/draft-js/~/fbjs/lib/UserAgent.js:35:0

Finished in 0.654 secs / 0 secs

SUMMARY:
✔ 0 tests completed

How to reproduce

You can reproduce it on a new project, after cloning the starter kit : npm install draft-js --save and add dependancies of this lib to a view, for example add the following code to src/views/HomeView/HomeView.js :

import {
  Editor,
  EditorState,
  RichUtils,
  Entity,
  CompositeDecorator,
} from 'draft-js'

and npm run test

related ?

I don't know if it's an issue related to this project, or directly related to fbjs or maybe phantomjs. So, sorry if it's not related to this project.

I also noticed that react@15.0.0 will use fbjs@0.8.0 https://github.com/facebook/react/blob/master/package.json#L38
So it will be also problematic for the react update.

@Freddy03h
Copy link
Author

Ok, thank's to the great help of @zpao on this issue facebook/fbjs#133 (comment)

I fixed the issue by adding babel-polyfill to the karma.conf.js file.

@dvdzkwsk
Copy link
Owner

dvdzkwsk commented Apr 7, 2016

Awesome, thanks for digging into it to figure out the exact issue and solution. I have some more to add to the discussion, but I will save that for your PR. Closing this since it's not an issue with the starter kit as it's intended, but see this comment and let me know your thoughts.

@dvdzkwsk dvdzkwsk closed this as completed Apr 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants