Skip to content

fix(testing): unset customConditions when running the open-cypress inferred task #31687

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

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

leosvelperez
Copy link
Member

Current Behavior

Cypress open-cypress inferred task in a workspace with the customConditions TypeScript compiler option set, fail with the error:

TSError: ⨯ Unable to compile TypeScript:
error TS5098: Option 'customConditions' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'.

This happens because Cypress forces ts-node to use module: commonjs and moduleResolution: node10, which is incompatible with the customConditions TypeScript compiler option.

Expected Behavior

Cypress open-cypress inferred task in a workspace with the customConditions TypeScript compiler option set should work as expected.

Related Issue(s)

Fixes #31616

@leosvelperez leosvelperez self-assigned this Jun 23, 2025
@leosvelperez leosvelperez requested a review from a team as a code owner June 23, 2025 09:52
@leosvelperez leosvelperez requested a review from AgentEnder June 23, 2025 09:52
Copy link

vercel bot commented Jun 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jun 23, 2025 9:52am

Copy link

nx-cloud bot commented Jun 23, 2025

View your CI Pipeline Execution ↗ for commit b651e3f.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 35m 49s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 17s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 3s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 2s View ↗
nx documentation ✅ Succeeded 2m View ↗

☁️ Nx Cloud last updated this comment at 2025-06-23 10:36:08 UTC

@FrozenPandaz FrozenPandaz added the priority: medium Medium Priority (not high, not low priority) label Jun 23, 2025
@@ -859,6 +871,9 @@ describe('@nx/cypress/plugin', () => {
},
"options": {
"cwd": ".",
"env": {
"TS_NODE_COMPILER_OPTIONS": "{"customConditions":null}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that running cypress open won't work without passing this environment variable either? Is there any way to have cypress open work without this environment variable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only way is not having customConditions in the tsconfig files. As mentioned in the PR description, Cypress uses ts-node to load the configuration file and forces module: commonjs, which is incompatible with the customConditions compiler option.

We already do the same in several other inferred tasks (including Cypress e2e tasks). This task was just previously missed.

@FrozenPandaz FrozenPandaz merged commit afb94af into master Jun 26, 2025
14 checks passed
@FrozenPandaz FrozenPandaz deleted the fix/issue-31616 branch June 26, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Medium Priority (not high, not low priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Infered open-cypress task fails with TS5098
3 participants