-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[🐛 Bug]: Import giving error ERROR @wdio/runner: Error: Cannot find package with paths defined in tsconfig.json #10857
Comments
Can you provide a minimal reproducible example please? |
@christian-bromann As mentioned in the description in import statement if specified as :
even though @Util is defined in tsconfig.json file under compilerOptions "paths": { "@Util/": [ |
I understand the problem, I am still asking for a minimal reproducible example. |
Reproducible steps are:
If in file (test/spec/yahoo-search-test.spec.ts) if we replace import statement as import yahooPage from '../pageobjects/yahoo-search.page.ts'; then this error is not seen. |
Thanks for providing the reproducible example! We greatly appreciate any contributions that help resolve the bug. While we understand that active contributors have their own priorities, we kindly request your assistance if you rely on this bug being fixed. We encourage you to take a look at our contribution guidelines or join our friendly Discord development server, where you can ask any questions you may have. Thank you for your support, and cheers! |
Due to bandwidth issue we won't be able to pick this for fixing. Are there any plans to fix it from your side as we are currently blocked due to this issue. |
Unfortunately I can't give say when or if I ever can pick this up. I really recommend get involved into the project and support with bugfixes like this, especially when it blocks you. |
I think we will have to wait till ts-node support this: TypeStrong/ts-node#1585 |
I have a question does this problem should also be reproducible if I'm using a JS? Because actually I'm facing the same problem, when trying to use alises. |
Using the
|
@aaggarwal-sumo can you verify that this resolves the issue for you with the latest version? |
Keep in mind that if you just switched from CJS to ESM and this suddenly fails that this is due to ESM requiring the extension in the path. So |
Can you help me How I can set this programatically? Picked from wdio.conf.ts
..... } and content of tsconfig.json is defined as: { |
@aaggarwal-sumo what do you mean by that? you can simply add the
|
I have documented this here: #11445 |
FYI if you mean that you want to set this inside of a hook or somewhere else in your config file, this is not possible |
Didn't work. |
Can you provide a minimal reproducible example please? |
Original description of issue already have reproducible example. |
Currently there is no chance for us to support |
Have you read the Contributing Guidelines on issues?
WebdriverIO Version
8.14.4
Node.js Version
20.5.0
Mode
WDIO Testrunner
Which capabilities are you using?
What happened?
Import giving error ERROR @wdio/runner: Error: Cannot find package with paths defined in tsconfig.json
I have defined path in tsconfig.json as:
"paths": {
Under Compiler options and I am using Import statement as:
import LoginUtil from '@Util/LoginUtil';
but getting error:
[2023-08-03T12:09:15.747Z] 2023-08-03T12:09:15.747Z ERROR @wdio/runner: Error: Cannot find package '@Util/LoginUtil' imported from //test/util/LogoutUtil.ts
[0-0] at packageResolve (/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:757:9)
[0-0] at moduleResolve (/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:798:18)
[0-0] at Object.defaultResolve (//node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:912:11)
[0-0] at /node_modules/ts-node/src/esm.ts:218:35
[0-0] at entrypointFallback (node_modules/ts-node/src/esm.ts:168:34)
[0-0] at /node_modules/ts-node/src/esm.ts:217:14
[0-0] at addShortCircuitFlag (node_modules/ts-node/src/esm.ts:409:21)
[0-0] at resolve (/node_modules/ts-node/src/esm.ts:197:12)
[0-0] at nextResolve (node:internal/modules/esm/hooks:733:28)
[0-0] at Hooks.resolve (node:internal/modules/esm/hooks:242:30)
I am using type: module in package.json and "module": "esnext", in tsconfig.json.
In case I use relative path as :
import LoginUtil from '../util/LoginUtil.ts'; then it works sucesfully.
What is your expected behavior?
Import statement should not throw any errors.
How to reproduce the bug.
Just try running basic test case where import of another package is required but specify the path of file from where we need to import with @PathValue/.
Relevant log output
Code of Conduct
Is there an existing issue for this?
The text was updated successfully, but these errors were encountered: