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

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array #27466

Open
ahmetozdemiras opened this issue Aug 4, 2023 · 6 comments
Labels
stale no activity on this issue for a long period topic: typescript type: bug

Comments

@ahmetozdemiras
Copy link

ahmetozdemiras commented Aug 4, 2023

Current behavior

When you use yarn cypress:run which is cypress run command with typescript@5 and if you defined your tsconfig.json file with multiple extends (which means it is an array), you are getting this error.

With Typescript@5, you can set extends value to be array now. With the latest version of Cypress, this code in line 94 causing an issue:

var extendedConfigPath = path.join(currentDir, extendedConfig);

where extendedConfig is an array. The file is tsconfig-loader.js.

Desired behavior

Cypress should support an array for extended configuration of Typescript since Typescript supports it now.

Test code to reproduce

Basic tsconfig.json such as:

{
  "extends": ["path/to/config"],
  ...
}

and latest version of Cypress (currently 12.17.3)

Cypress Version

12.17.3

Node version

v18.16.0

Operating System

macOS 13.5

Debug Logs

No response

Other

No response

@NextThread
Copy link

hey, I'd like to work on this issue

@awx-josh-fu
Copy link

Hi, may I ask what's the status of this issue?

@jordanpowell88
Copy link
Contributor

@NextThread are you working on this?

@mrkjdy
Copy link

mrkjdy commented Feb 2, 2024

There's an issue on ts-nodes side about this problem TypeStrong/ts-node#2000. It's been open since April 2023. Apparently it's fixed, but they don't want to create a new release for some reason. Could Cypress install ts-node from GitHub?

Another option is to switch to tsx. It's been much more reliable for me. Using tsc to check types and tsx to run code has been an awesome solution for me!
Check it out here https://github.com/privatenumber/tsx

I was hoping that the fix for #28385 would have fixed this problem too

@alikhalilifar
Copy link

alikhalilifar commented Mar 18, 2024

I fixed it by doing this at the CI level before running tests:

cp -r ../../node_modules/ts-node ~/.cache/Cypress/13.6.4/Cypress/resources/app/node_modules/ts-node

We are patching the Cypress cache bin's ts-node using the application's main ts-node (11.0.0-beta.1). This is not optimal at all for obvious reasons, so I'm wondering if there is a plan to update the ts-node version of the Cypress to 11.0.0-beta.1

@jennifer-shehane I see you have marked this issue so I would appreciate your guidance on how to approach this problem 😊

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period topic: typescript type: bug
Projects
None yet
Development

No branches or pull requests

9 participants