Closed shyambh closed 2 years ago
Also can you please add 'hactoberfest-accepted' label to this PR if you think it is fine?
Like so:
@shyambh I didn't know I had to do that, sorry. Done now.
This MR breaks the config with
Your configFile is invalid: ...magento2-cypress-testing-suite/cypress.config.js
It threw an error when required, check the stack trace below:
Error [ERR_REQUIRE_ESM]: require() of ES Module ...magento2-cypress-testing-suite/node_modules/del/index.js from ...magento2-cypress-testing-suite/cypress.config.js not supported.
Instead change the require of index.js in /Volumes/CaseSensitive/Workspace/php-sites/mos-hyva-245/magento2-cypress-testing-suite/cypress.config.js to a dynamic import() which is available in all CommonJS modules.
Adding a dependency for something as simple as deleting files and folders recursively is maybe not necessary.
@Vinai Thank you for this. I will take a look at this.
Another issue is you use _
(lowbar/underscore), which is not available.
return _.some(test.attempts, { state: 'failed' })
Again, instead of using a dependency, why not use native JS?
return test.attempts.find(({state}) => state === 'failed')
Did you even test the code before submitting the PR @shyambh ?
@Vinai I really want to apologize for this.
I used a dynamic import for the 'del' package and now the tests are running.
Regarding the dependency on the external package, I followed the implementation steps mentioned in the Cypress documentation here:
https://docs.cypress.io/api/plugins/after-spec-api#Delete-the-recorded-video-if-no-tests-retried
Please let me know if I can push the fix?
Don't worry, already opened a PR https://github.com/elgentos/magento2-cypress-testing-suite/pull/100
I have updated the cypress.config.js file to add the code to delete the recorded videos if none of the tests are retried. I basically simply followed the steps mentioned here: https://docs.cypress.io/api/plugins/after-spec-api#Delete-the-recorded-video-if-no-tests-retried