Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update decorators in @packages/data-context to use Stage 3 decorators #31184

Open
AtofStryker opened this issue Feb 27, 2025 · 0 comments
Labels
Cypress 15 pkg/data-context This is due to an issue in the packages/data-context directory

Comments

@AtofStryker
Copy link
Contributor

What would you like?

Currently, the @packages/data-context package uses the TypeScript experimentalDecorators option, which uses the Stage 2 decorators proposal. Since TypeScript 5 released, the default is now to using the official Stage3 / accepted decorators proposal, which takes 2 arguments instead of 3 arguments. This can be seen with the cached decorator.

Why is this needed?

We are planning to replace ts-node with tsx to transpile user config files as well as run certain cypress packages. tsx. When performing the POC described in #30426, we ran into a few issues, this one in particular when running the binary smoke tests:

Error [ERR_INTERNAL_ASSERTION]: Code: ERR_MODULE_NOT_FOUND; The provided arguments length (2) does not match the required ones (3).
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues

This is most likely an issue with the data-context package, which doesn't compile itself and is instead references as raw typescript inside @packages/server, @packages/graphql to manage state while cypress is running, and is also used in @packages/app, @packages/launchpad, and @packages/frontend-shared for cy-in-cy tests to mutate server state for us to be able to test cy-in-cy correctly. We HAVE seen this issue inside our system tests, and have to offer a test specific tsconfig.json to work around the issue (which can be seen here).

Since the tsconfig.jsons per package do NOT compile the data-context package directly, the package is left configless in tsx, in which tsx then tries to compile the file, which fails because we are using experimentalDecorators in the data-context package. experimentalDecorators uses the ECMA stage 2 proposal of the decorators (which was introduced pre typescript 5), which takes 3 arguments. TypeScript 5 added support for the TC39 Stage 3 decorators, which only takes 2 arguments. I believe this is why we are seeing this issue.

We would likely get better output when we update Electron 35 as it is on Node 22 (see nodejs/node#51477).

Other

you can reproduce the node error on the smoke test by running the following locally:

yarn binary-build
V8_SNAPSHOT_DISABLE_MINIFY=1 yarn binary-package --skipSigning
yarn binary-smoke-test
@AtofStryker AtofStryker changed the title Update decorators in @packages/data-context to use Stage 3 decorators chore: update decorators in @packages/data-context to use Stage 3 decorators Feb 27, 2025
@AtofStryker AtofStryker added pkg/data-context This is due to an issue in the packages/data-context directory Cypress 15 labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cypress 15 pkg/data-context This is due to an issue in the packages/data-context directory
Projects
None yet
Development

No branches or pull requests

1 participant