Skip to content

Commit

Permalink
update(imports): change import for tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
elaichenkov committed Sep 14, 2022
1 parent 290a002 commit bdd700c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ require('cy-verify-downloads').addCustomCommand();
Then you need to add the following lines of code to your project's `cypress.config.js`:

```javascript
const { isFileExist, findFiles } = require('cy-verify-downloads');
const { verifyDownloadTasks } = require('cy-verify-downloads');

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('task', { isFileExist, findFiles });
on('task', verifyDownloadTasks);
},
},
});
Expand All @@ -53,10 +53,10 @@ require('cy-verify-downloads').addCustomCommand();
And add the following lines to your project's `cypress/plugins/index.js`:

```javascript
const { isFileExist, findFiles } = require('cy-verify-downloads');
const { verifyDownloadTasks } = require('cy-verify-downloads');

module.exports = (on, config) => {
on('task', { isFileExist, findFiles })
on('task', verifyDownloadTasks)
}
```

Expand Down
4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const { defineConfig } = require('cypress');
const { isFileExist, findFiles } = require('./src/index');
const { verifyDownloadTasks } = require('./src/index');

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('task', { isFileExist, findFiles });
on('task', verifyDownloadTasks);
},
baseUrl: 'http://localhost:8039',
},
Expand Down
5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ const findFiles = ({ path, fileName }) => {
const isDownloaded = (file) => !file.endsWith('.crdownload');

module.exports = {
// TODO: deprecate these exports in the next major release
isFileExist,
findFiles,
addCustomCommand,
verifyDownloadTasks: {
isFileExist,
findFiles,
},
};

0 comments on commit bdd700c

Please sign in to comment.