webdriverio-schematics icon indicating copy to clipboard operation
webdriverio-schematics copied to clipboard

Typing is not recognized in Vscode

Open Badisi opened this issue 3 years ago • 8 comments

Version: v1.1.1

Issue

Running ng add @wdio/schematics will add a test/tsconfig.e2e.json file.

But Vscode only knowns typescript configuration file named tsconfig.json.

This results in multiple typing errors :

Screen Shot 2021-11-09 at 16 14 01

Solution

Use tsconfig.json instead of tsconfig.e2e.json to name the typescript configuration file.

Badisi avatar Nov 09 '21 15:11 Badisi

@Badisi what is your experience of having different tsconfig files for app and test files?

christian-bromann avatar Nov 09 '21 15:11 christian-bromann

For one, angular is using a tsconfig.json with "module": "es2020" whereas for the tests we need a tsconfig.json with "module": "commonjs"

Badisi avatar Nov 09 '21 15:11 Badisi

Ah I remember the issue. Yeah in this case we surely need a separate tsconfig.json.

christian-bromann avatar Nov 09 '21 15:11 christian-bromann

The schematics already adds a second tsconfig file in /test, which is great !

But the issue here is that the file is named tsconfig.e2e.json which Vscode doesn't know about...

Making sure we get a test/tsconfig.json instead of test/tsconfig.e2e.json would allow Vscode to find it and properly resolves typing

Badisi avatar Nov 09 '21 15:11 Badisi

Making sure we get a test/tsconfig.json instead of test/tsconfig.e2e.json would allow Vscode to find it and properly resolves typing

Sounds like a reasonable solution to me, mind sending in a PR?

christian-bromann avatar Nov 09 '21 15:11 christian-bromann

Working on it as we speak but also working on other improvements too ;-)

Badisi avatar Nov 09 '21 15:11 Badisi

Thanks so much! Keep them coming ☺️

christian-bromann avatar Nov 09 '21 15:11 christian-bromann

For this one to work completely we would also have to make sure that the wdio.conf.ts is located in the /test folder.

Otherwise Vscode would also complain about typing.

Screen Shot 2021-11-09 at 19 23 53

Badisi avatar Nov 09 '21 18:11 Badisi