mfrachet / cypress-audit

⚡ Run Lighthouse and Pa11y audits directly in your E2E test suites
https://mfrachet.github.io/cypress-audit/
MIT License
351 stars 44 forks source link

CRA example does not work out of the box: Unexpected token '??=' #225

Closed dwjohnston closed 1 year ago

dwjohnston commented 1 year ago

Before creating an issue, make sure to have setup the projects with the 3 steps provided in the README. You can also verify the examples folder and check if there is already an application using a similar setup to yours.

Sorry not actually sure which three steps those are. But my repro occurs with the CRA example in the code base.

What does not work?

When we run the tests non-headlessly we get an error:

cy.task('lighthouse') failed with the following error:
> Unexpected token '??='[Learn more](https://on.cypress.io/api/task)
[node_modules/@cypress-audit/lighthouse/src/command-handler.js:46:1](http://localhost:3000/__/#)
image

How to reproduce?

Checkout codebase here: https://github.com/dwjohnston/cypress-audit/commit/1ed6e71237347fd2cb7d9d7b91466622779c1c75

cd cypress-audit/examples/cra-authenticated
nvm use 18.16
yarn
yarn serve build -s -l 3000

In a different terminal:

yarn e2e:audit

Run the test.

Expected behavior The tests should pass I suppose.

Screenshots / Animated Gifs Add screenshots or screen recordings to help explain your problem.

Environment (please complete the following information):

dwjohnston commented 1 year ago

Argh, never mind. I was actually running node 14.