I have to download a excel file lets say "someData.xlsx" during test execution meanwhile before downloading also have to put a check over download folder if "someData.xlsx" exist in download folder delete it before downloading the newly updated file. could someone explain how to achieve this ?
I tried this but getting fs.readdirSync is not a function
fs.readdirSync('./downloads').forEach((file) => {
fs.unlinkSync(`./downloads/${file}`);
});

install cypress-delete-downloads-folder by
npm i -D cypress-delete-downloads-folderin plugins/index.js
in support/commands.js
in your test spec file