- I have installed “@cypress/code-coverage”: “^3.12.39”,
- And added import “@cypress/code-coverage/support”; ui/e2e/cypress/support/e2e.js
- And added require(“@cypress/code-coverage/task”)(on, config); under setupNodeEvents(on, config) in ui/e2e/cypress.config.js
while running Cypress and click on the test file getting the following error
<code> ./node_modules/@cypress/code-coverage/support.js 70:44
Module parse failed: Unexpected token (70:44)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| const saveCoverageObject = (win) => {
| // if application code has been instrumented, the app iframe "window" has an object
> const applicationSourceCoverage = win?.__coverage__
| if (!applicationSourceCoverage) {
| return
@ ./cypress/support/e2e.js 55:0-40
@ multi ./cypress/support/e2e.js
</code>
<code> ./node_modules/@cypress/code-coverage/support.js 70:44
Module parse failed: Unexpected token (70:44)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| const saveCoverageObject = (win) => {
| // if application code has been instrumented, the app iframe "window" has an object
> const applicationSourceCoverage = win?.__coverage__
| if (!applicationSourceCoverage) {
| return
@ ./cypress/support/e2e.js 55:0-40
@ multi ./cypress/support/e2e.js
</code>
./node_modules/@cypress/code-coverage/support.js 70:44
Module parse failed: Unexpected token (70:44)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| const saveCoverageObject = (win) => {
| // if application code has been instrumented, the app iframe "window" has an object
> const applicationSourceCoverage = win?.__coverage__
| if (!applicationSourceCoverage) {
| return
@ ./cypress/support/e2e.js 55:0-40
@ multi ./cypress/support/e2e.js