Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'toPromise' of undefined #353

Open
timB73 opened this issue Aug 7, 2020 · 5 comments
Open

Cannot read property 'toPromise' of undefined #353

timB73 opened this issue Aug 7, 2020 · 5 comments

Comments

@timB73
Copy link

timB73 commented Aug 7, 2020

I am using redux-saga version 1.1.3 and version 4.0.0-rc.3 of redux-saga-test-plan. Are these not compatible with each other?
I ran the example test and I get the following error: "TypeError: Cannot read property 'toPromise' of undefined" which happens at the run() method.

at taskPromise (node_modules/redux-saga-test-plan/lib/expectSaga/index.js:590:17)
at start (node_modules/redux-saga-test-plan/lib/expectSaga/index.js:601:23)
at Object.run (node_modules/redux-saga-test-plan/lib/expectSaga/index.js:646:5)

@timB73
Copy link
Author

timB73 commented Aug 7, 2020

I seem to get the same error with version 1.1.1 of redux-saga and 4.0.0-rc.2 of redux-saga-test-plan

@jp928
Copy link
Collaborator

jp928 commented Aug 7, 2020

@timB73 do you have sample to reproduce this?

@timB73
Copy link
Author

timB73 commented Aug 7, 2020

Actually it looks like it might not be to do with redux-saga-test-plan as I got the same error trying to create my own helper function based on redux-saga docs... very confused 🤔

import { runSaga } from 'redux-saga';

export async function recordSaga(saga, initialAction, initialState) {
  const dispatched = [];

  await runSaga(
    {
      dispatch: action => dispatched.push(action),
      getState: () => initialState
    },
    saga,
    initialAction
  ).toPromise();

  return dispatched;
}

It gives error cannot read 'toPromise' of undefined when I call runSaga with a basic generator function. I can't find anything about this anywhere so must be something to do with my setup ??

@jakobdamjensen
Copy link

I am experiencing the same problem here with code very similar to yours @timB73 . Did you find a solution?

@timB73
Copy link
Author

timB73 commented Dec 2, 2020

I am experiencing the same problem here with code very similar to yours @timB73 . Did you find a solution?

Unfortunately I didn't :(

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

No branches or pull requests

3 participants