cypress
cypress copied to clipboard
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array
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
hey, I'd like to work on this issue
Hi, may I ask what's the status of this issue?
@NextThread are you working on this?
There's an issue on ts-node
s side about this problem https://github.com/TypeStrong/ts-node/issues/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 https://github.com/cypress-io/cypress/issues/28385 would have fixed this problem too
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 😊