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

Types for custom commands added by wdio-vscode-service #95

Open
openscript opened this issue Dec 1, 2023 · 6 comments
Open

Types for custom commands added by wdio-vscode-service #95

openscript opened this issue Dec 1, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@openscript
Copy link
Contributor

How to get the types for custom commands like getWorkbench() working?

image

The following tsconfig.json is applied:

{
	"include": ["./spec/**/*.e2e.test.ts", "./wdio.conf.ts"],
	"compilerOptions": {
		"module": "ESNext",
		"types": [
			"node",
			"@wdio/globals",
			"wdio-vscode-service",
			"@wdio/mocha-framework",
			"expect-webdriverio"
		],
		"target": "es2022",
		"moduleResolution": "node",
		"esModuleInterop": true,
		"experimentalDecorators": true
	}
}
@christian-bromann christian-bromann added the bug Something isn't working label Dec 1, 2023
@christian-bromann christian-bromann self-assigned this Dec 1, 2023
@openscript
Copy link
Contributor Author

If I add import {} from "wdio-vscode-service" where I use getWorkbench() or if I use "wdio-vscode-service/service" in the tsconfig.json types VSCode can resolve the types. Quite weird.. something with type declaration merging doesn't seem to work like it should.

I'm on VSCode:

Version: 1.84.2
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:50:47.800Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.6.3-arch1-1

@christian-bromann
Copy link
Contributor

@openscript can you compare your setup with the one that is being created when running npm init wdio@latest ./foobar and selecting "VS Code Extension Testing"? I just bootstrapped a new project and the types were resolved as expected.

@openscript
Copy link
Contributor Author

openscript commented Dec 2, 2023

That works for me too.

Now I'm suspecting pnpm which is used in the project with the issue.

@openscript
Copy link
Contributor Author

That's the project: opral/monorepo#1795

@christian-bromann
Copy link
Contributor

christian-bromann commented Dec 2, 2023

I checked out the repo and it is indeed weird why types aren't resolved. Even if I add /// <reference types="wdio-vscode-service" /> at the top instead of import {} from "wdio-vscode-service" it works. I also tried to copy the dependency into the node_modules directory to remove the chance it could have to do with pnpm linking. The setup looks fine to me.

@seanpoulter
Copy link
Contributor

Any luck @openscript? I saw opral/monorepo#1795 was merged. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants