Ao executar o código: npx cypress run --reporter mochawesome
Ocorre o erro abaixo:
DevTools listening on ws://127.0.0.1:51070/devtools/browser/fad884d4-3575-4eeb-8037-ed0d40605548 Your configFile threw an error from: C:\Users\rafa_\Desktop\Estudo\Cypress\testes-cypress\cypress.config.js
The error was thrown while executing your e2e.setupNodeEvents() function:
ReferenceError: defineConfig is not defined at setupNodeEvents (C:\Users\rafa_\Desktop\Estudo\Cypress\testes-cypress\cypress.config.js:4:7) at C:\Users\rafa_\AppData\Local\Cypress\Cache\13.1.0\Cypress\resources\app\node_modules@packages\server\lib\plugins\child\run_plugins.js:122:14 at tryCatcher (C:\Users\rafa_\AppData\Local\Cypress\Cache\13.1.0\Cypress\resources\app\node_modules\bluebird\js\release\util.js:16:23) at Function.Promise.attempt.Promise.try (C:\Users\rafa_\AppData\Local\Cypress\Cache\13.1.0\Cypress\resources\app\node_modules\bluebird\js\release\method.js:39:29) at RunPlugins.load (C:\Users\rafa_\AppData\Local\Cypress\Cache\13.1.0\Cypress\resources\app\node_modules@packages\server\lib\plugins\child\run_plugins.js:119:9) at RunPlugins.runSetupNodeEvents (C:\Users\rafa_\AppData\Local\Cypress\Cache\13.1.0\Cypress\resources\app\node_modules@packages\server\lib\plugins\child\run_plugins.js:59:17) at EventEmitter. (C:\Users\rafa_\AppData\Local\Cypress\Cache\13.1.0\Cypress\resources\app\node_modules@packages\server\lib\plugins\child\run_require_async_child.js:185:22) at EventEmitter.emit (node:events:390:28) at process. (C:\Users\rafa_\AppData\Local\Cypress\Cache\13.1.0\Cypress\resources\app\node_modules@packages\server\lib\plugins\util.js:33:22) at process.emit (node:events:390:28) at emit (node:internal/child_process:917:12) at processTicksAndRejections (node:internal/process/task_queues:84:21)
O meu arquivo cypress.config.js está configurado com o código abaixo:
module.exports = { e2e: { setupNodeEvents(on, config) { module.exports = defineConfig({ e2e: { setupNodeEvents(on, config) { { "reporter"; "mochawesome", "reporterOptions"; { "reportDir"; "cypress/report/mochawesome-report", "overwrite"; true, "html"; true, "json"; false, "timestamp"; "mmddyyyy_HHMMss" }} }, }, }); }, }, };
E o meu projeto está no diretório:
C:\Users\rafa_\Desktop\Estudo\Cypress\testes-cypress\cypress
O que pode estar causando esse erro de execução?
Desde já agradeço a ajuda de todos.