epicweb-dev/advanced-react-apis

Errors on initial validation

Closed this issue · 3 comments

I just cloned the repo, started the setup and I got this two errors:

 FAIL  src/__tests__/01.js
  ● using useReducer

    TypeError: Cannot read property 'toString' of undefined

      30 |   React.createElement = createElement
      31 |
    > 32 |   const lines = counterFn.toString().split('\n')
         |                           ^
      33 |   const useReducerLine = lines.find(line => {
      34 |     return !line.trim().startsWith('//') && line.includes('useReducer(')
      35 |   })

      at Object.<anonymous> (src/__tests__/01.js:32:27)

 FAIL  src/__tests__/03.js
  ● CountProvider is rendering a context provider with the right value

    expect(received).toEqual(expected) // deep equality

    Expected: [0, Any<Function>]
    Received: undefined

      37 |   render(<App />)
      38 |
    > 39 |   expect(providerProps.value).toEqual([0, expect.any(Function)])
         |                               ^
      40 |
      41 |   act(() => {
      42 |     providerProps.value[1](1) // lol

      at Object.<anonymous> (src/__tests__/03.js:39:31)

Obviously it is a fresh copy of the repo, nothing changed.

I see in the last commit comments that you can do DISABLE_NEW_JSX_TRANSFORM=true npm test so it works. I'll leave this open until it get fixes so if someone comes with the same problem, they can see this issue.

I'm having this problem as well but that fix worked for me too. Thanks!

the problem still exists.