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:
master (this is commit f15b41273f8d927cf74a6e03238e37e3cca44b4d at time of writing)yarn install (since there's a yarn.lock in the directory, I assume this is the right step)yarn testJest 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
Many tests should run and they should all pass!
f15b41273f8d927cf74a6e03238e37e3cca44b4dI 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)
I have the same problem too
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)
Hey @johnrjj what branch did you use to get the test working?
@flexzuu npm install --save [email protected] (latest alpha release) fixes it for me.
@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.
CI Seems to be broken aswell:
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 | |
----------|----------|----------|----------|----------|----------------|
@flexzuu this is fixed in https://github.com/apollographql/react-apollo/pull/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 🎉
Most helpful comment
I have the same problem too