Closed scottohara closed 1 year ago
Same issue here, works ok with ES2019 but not with ES2020. Also it won't work in the support
folder, for instance for a before
script, even with ES2019.
This was resolved in Cypress 12.17.4, that upgraded the internal version of webpack that Cypress uses to bundle e2e tests from v4 to v5.
After upgrading from
cypress@4.8.0
tocypress@6.8.0
, the e2e suite started failing when compiling the following code (fromsupport/schedules/index.ts
):The reason it started failing after the Cypress upgrade was that they fixed the issue of ignoring user-supplied tsconfig.json files.
This fix meant that the tests were now being compiled using
target: ES2020
(from thetsconfig.json
file in the project root).Nullish coalescing should be supported in ES2020, however there is a bug in acorn 6.x (used by webpack 4), which is fixed in acorn 7.3.0 (used by webpack 5). It seems that webpack 4 is unlikely to be upgraded to the fixed version of acorn; so the issue should eventually be resolved once we can upgrade to webpack 5.
In the meantime, there is a somewhat odd workaround by setting
target: ES2019
(incypress/tsconfig.json
).https://stackoverflow.com/questions/58813176/webpack-cant-compile-ts-3-7-optional-chaining-nullish-coalescing
This is only a stop-gap measure while we wait to upgrade to webpack 5