https://cypress.io logo
How to get my cy.task() to show correctly during C...
# i-need-help
c
my code in test:
Copy code
cy.task('show_files', __dirname).then((file) => forEach((file) => cy.log(file)))
output:
Copy code
task:            show_files, cypress/integration/tests
my task code:
Copy code
on('task', {
    show_files(directory) {
    return fs.readdirSync(directory);
}

}
My custom cy.task
Copy code
show_files()
works but I can't get my Cypress logs to list the contents of my directory. fs.readdirSync() returns an Array. How can I loop through the returned Array to show each element in Cypress? I spent 8 hours on this ticket and I can't figure it out.. :[