When a takeEvery has a non-generator function as the second argument, the saga runs fine in the application, but errors when it is run by redux-saga-test-plan's expectSaga.
Expected behaviour
There is no error in the test when there is no error in the application code.
Actual behaviour
This error is printed in the terminal:
TypeError: Cannot read properties of undefined (reading 'next')
at getNext (project/node_modules/redux-saga-test-plan/lib/expectSaga/sagaWrapper.js:51:32)
at Object.INIT (project/node_modules/redux-saga-test-plan/lib/expectSaga/sagaWrapper.js:74:18)
at Object.next (project/node_modules/fsm-iterator/lib/index.js:91:37)
at next (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1161:27)
at proc (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1112:3)
at project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:589:17
at immediately (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:60:12)
at runForkEffect (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:588:3)
at runEffect (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1208:7)
at digestEffect (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1275:5)
at next (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1165:9)
at currCb (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:1255:7)
at takeCb (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:507:5)
at put (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:343:9)
at project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:380:7
at exec (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:35:5)
at flush (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:91:5)
at asap (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:50:5)
at Object.chan.put (project/node_modules/@redux-saga/core/dist/redux-saga-core.dev.cjs.js:379:5)
at notifyListeners (project/node_modules/redux-saga-test-plan/lib/expectSaga/index.js:327:15)
at project/node_modules/redux-saga-test-plan/lib/expectSaga/index.js:341:34
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Updating the takeEvery to yield takeEvery("action", function* () {}); causes the error to go away, however, both the generator and non-generator versions work when running in my application.
Summary
When a
takeEvery
has a non-generator function as the second argument, the saga runs fine in the application, but errors when it is run by redux-saga-test-plan'sexpectSaga
.Expected behaviour
There is no error in the test when there is no error in the application code.
Actual behaviour
This error is printed in the terminal:
Reproduction
Updating the
takeEvery
toyield takeEvery("action", function* () {});
causes the error to go away, however, both the generator and non-generator versions work when running in my application.Dependencies
These are the versions I have in the project:
And I'm running the tests with node v16.15.0