ui5-community / wdi5

official UI5 end-to-end test framework for UI5 web-apps. wdi5 = Webdriver.IO + UI5 Test API
https://ui5-community.github.io/wdi5/
Apache License 2.0
102 stars 43 forks source link

Question: Are 'paths' in tsconfig supported? #624

Closed heimwege closed 1 week ago

heimwege commented 2 months ago

Hey guys πŸ‘‹πŸ»

I just tried to use the paths defined in my .tsconfig in the wdi5 tests instead of the relative ones. In a TypeScript ui5 project with the transpile middleware that works perfectly fine. Also in the wdi5 test the TS compiler does not complain about the path.

The path documentation states

Note that this feature does not change how import paths are emitted by tsc,
so paths should only be used to inform TypeScript that another tool has this mapping and
will use it at runtime or when bundling.

So guess this is not (yet) supported but I wanted to ask so that it is documented somewhere in case someone else comes up with the same idea πŸ˜„

Sample:

.tsconfig:

    "paths": {
      "this/is/my/path/*": ["./webapp/*"]
    },

Foo.test.ts

import bar from "this/is/my/path/test/wdi5/pages/GenericPage";
// import bar from "../pages/GenericPage"; // <-- that one works

Executing the wdi5 tests fails with

Error: Error: Cannot find module 'this/is/my/path/test/wdi5/pages/GenericPage'
Require stack:
...

Runtime Env (please complete the following information):

dominikfeininger commented 1 month ago

it is expected to work like it is used in wdio https://v5.webdriver.io/docs/typescript.html

heimwege commented 1 month ago

Thanks for the information πŸ‘πŸ» Then I'll try to create a (not) running sample of the above issue and post it here for following up

heimwege commented 1 month ago

Here you go: running npm run test:ts-app on main works fine, running it on https://github.com/heimwege/wdi5/tree/wdi5-tsconfig-path-issue results in an error for the MultiInput.test.js because of the import using a path as defined in tsconfig.

It's not exactly the same error message that I get in my repo (see above)

Error: Error: Cannot find package 'tsapptest' imported from <local path on my machine>\wdi5\examples\ui5-ts-app\test\e2e\MultiInput.test.ts

but hopefully it is caused by the same issue with the path.

github-actions[bot] commented 3 weeks ago

hey πŸ‘‹ - silence for 30 days 🀐 ... anybody? πŸ˜€

github-actions[bot] commented 1 week ago

closed πŸ“΄ because silencio 🀫 since an additional 14 days after staleness πŸ“ 

heimwege commented 1 week ago

So I guess the answer is "no this is currently not supported" πŸ€·β€β™‚οΈ