Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Problems setting up local environment #717

Closed
dallonf opened this issue May 18, 2017 · 7 comments
Closed

Problems setting up local environment #717

dallonf opened this issue May 18, 2017 · 7 comments

Comments

@dallonf
Copy link

dallonf commented May 18, 2017

I just forked and cloned react-apollo, hoping to try to fix a bug I found, but ran into some issues that prevent me from contributing:

Steps to Reproduce

  1. Clone react-apollo from master (this is commit f15b41273f8d927cf74a6e03238e37e3cca44b4d at time of writing)
  2. Run yarn install (since there's a yarn.lock in the directory, I assume this is the right step)
  3. Run yarn test

Buggy Behavior

Jest finds no tests:

No tests found
In /Users/username/devroot/oss/react-apollo
  2315 files checked.
  testMatch:  - 2315 matches
  testPathIgnorePatterns: /node_modules/ - 84 matches
  testRegex: <rootDir>/test/.*.test.(ts|tsx|js)$ - 0 matches
Pattern: "" - 0 matches

Expected Behavior

Many tests should run and they should all pass!

Versions

  • macOS Sierra 10.12.3
  • Node v6.3.1
  • Yarn v0.23.4
  • as mentioned above, commit f15b41273f8d927cf74a6e03238e37e3cca44b4d

But wait, there's more

I noticed that the testRegex is... well, not really a regex. A quick skim of the Jest docs suggests that the <rootDir> macro isn't supported for this open, so I removed it in package.json:

{
  ...
  "jest": {
    ...
    "testRegex": "test/.*.test.(ts|tsx|js)$"
  } 
}

This gets a little bit further, but most test suites now fail with errors like:

  ● Test suite failed to run

    TypeError: Cannot read property 'ReactCurrentOwner' of undefined

      at Object.<anonymous> (node_modules/react-dom/cjs/react-dom.development.js:2394:36)
      at Object.<anonymous> (node_modules/react-dom/index.js:6:20)
      at Object.<anonymous> (test/react-web/client/graphql/queries/loading.test.tsx:29:16)
      at handle (node_modules/worker-farm/lib/child/index.js:41:8)
      at process.<anonymous> (node_modules/worker-farm/lib/child/index.js:47:3)
      at emitTwo (events.js:106:13)
      at process.emit (events.js:191:7)
      at process.nextTick (internal/child_process.js:719:12)
      at _combinedTickCallback (internal/process/next_tick.js:67:7)
      at process._tickCallback (internal/process/next_tick.js:98:9)
@hiaw
Copy link

hiaw commented May 19, 2017

I have the same problem too

@johnrjj
Copy link

johnrjj commented May 24, 2017

Update: react-apollo v1.3.0-alpha.1 works for me.

Leaving post below for others:

Second this...Can't find a workaround. Coming from CRA w/ react-apollo added in.

react-apollo v1.2.0 (tested 1.1.3 as well)

Tried to do a simple shallow render w/ enzyme & Jest. Even tried using only ReactDOM.

  ● Test suite failed to run

    TypeError: Cannot read property 'ReactCurrentOwner' of undefined
      
      at Object.<anonymous> (node_modules/react-apollo/node_modules/react-dom/cjs/react-dom-server.development.js:5861:36)
      at Object.<anonymous> (node_modules/react-apollo/node_modules/react-dom/server.js:6:20)
      at Object.<anonymous> (node_modules/react-apollo/lib/server.js:4:16)
      at Object.<anonymous> (node_modules/react-apollo/lib/index.js:7:16)
      at Object.<anonymous> (src/components/MyComponent.component.js:16:46)

@flexzuu
Copy link
Contributor

flexzuu commented May 26, 2017

Hey @johnrjj what branch did you use to get the test working?

@johnrjj
Copy link

johnrjj commented May 26, 2017

@flexzuu npm install --save [email protected] (latest alpha release) fixes it for me.

@flexzuu
Copy link
Contributor

flexzuu commented May 26, 2017

@johnrjj i think we talk about different things. I want to get the tests working to develop a feature for react-apollo. It seems you just wanted to use react-apollo. On my side react-apollo is working but the test-setup seems to be broken.

@flexzuu
Copy link
Contributor

flexzuu commented May 26, 2017

CI Seems to be broken aswell:

Travis CI

No tests found
In /home/travis/build/apollographql/react-apollo
  2274 files checked.
  testMatch:  - 2274 matches
  testPathIgnorePatterns: /node_modules/ - 81 matches
  testRegex: <rootDir>/test/.*.test.(ts|tsx|js)$ - 0 matches
Pattern: "" - 0 matches
File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
All files |  Unknown |  Unknown |  Unknown |  Unknown |                |
----------|----------|----------|----------|----------|----------------|

@jbaxleyiii
Copy link
Contributor

@flexzuu this is fixed in #695 I'm not sure where it was broken actually!

That PR will be merged tomorrow into master so I'd start working off of it 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants