agiledigital / typed-redux-saga

An attempt to bring better TypeScript typing to redux-saga.
MIT License
315 stars 33 forks source link

`TypeError: yield* (intermediate value) is not iterable` Error while running tests with Jest and redux-saga-test-plan #696

Closed mattg95 closed 10 months ago

mattg95 commented 11 months ago

Hi, I have converted a project from redux-saga to typed-redux-saga. When running existing tests using Jest and redux-saga-test-plan I encounter this error:

TypeError: yield* (intermediate value) is not iterable

The error was not present before when we were using yield() instead of yield*()syntax.

I'm using the macro, and if I've understood the docs correctly, it should transpile to use the original yield() syntax instead of yield*() - but it's not doing that in the tests.

I have set up the project to use the macro by running yarn add typed-redux-saga and have set up the .babelrc file like this: .babelrc

{
  "plugins": ["macros"]
}

All saga imports use the macro: import { put, select, takeLatest } from 'typed-redux-saga/macro'

My jest.config.js file uses:

  transform: {
    '^.+\\.tsx?$': 'babel-jest',
  }

Which is the fix suggested here.

mattg95 commented 10 months ago

Update: I had misread 'jsx' for 'tsx' in my jest.config file. Applying the fix here fixes it