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

The 'task' event has not been registered in the setupNodeEvents method. #117

Open
PeterFast4 opened this issue Jul 3, 2023 · 3 comments
Assignees

Comments

@PeterFast4
Copy link

PeterFast4 commented Jul 3, 2023

Hello,

I have a little problem with your plugin. I get this error message:

cy.task('findFiles') failed with the following error:

The 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task()

const { isFileExist } = require('cy-verify-downloads')

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
on('task', isFileExist)
realHover.install(on)
},
},
})

Cypress version 12.12.00

Thx for your help

@elaichenkov
Copy link
Owner

Thank you for reporting the issue. Can you please try to import and set up verifyDownloadTasks object? Please, let me know if it works for you.

- const { isFileExist } = require('cy-verify-downloads')
+ const { verifyDownloadTasks } = require('cy-verify-downloads');

module.exports = defineConfig({
  e2e: {
   setupNodeEvents(on, config) {
    // implement node event listeners here
-       on('task', isFileExist)
+       on('task', verifyDownloadTasks)
        realHover.install(on)
   },
  },
})

@elaichenkov elaichenkov self-assigned this Jul 6, 2023
@PeterFast4
Copy link
Author

PeterFast4 commented Jul 7, 2023

Hi,

I have this error:

cy.task('findFiles') failed with the following error:
The 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task()
Fix this in your setupNodeEvents method here:
/Users/username/projects/apps/project/client-e2e/cypress.config.ts

@agarciarsu
Copy link

In case it helps, error solved with

const { verifyDownloadTasks } = require('cy-verify-downloads');
{
...
    setupNodeEvents(on) {
      on('task', { ...verifyDownloadTasks });
    },
...
}

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