Open LakshmiYaswanth opened 1 year ago
Can you explained in a bit more detail what you mean by that?
@LakshmiYaswanth Please provide more detail in your question / request. What would be extremely helpful is if you could provide an example of asynchronous code using wdio-intercept-service that you would like to have work, but which does not currently work.
Maybe I can help: Using typescript, I am not able to have my esLint able to infer the correct returned type of browser.getRequests() etc. etc.
I can see that the signature will depend if web
here are the types used in tsConfig:
"types": [ "node", "expect-webdriverio", "wdio-intercept-service", "@wdio/globals/types", "@wdio/cucumber-framework" ],
My dev dependencies:
"devDependencies": { "@angular/animations": "^16.2.1", "@angular/cdk": "^16.2.1", "@angular/common": "^16.2.1", "@angular/core": "^16.2.1", "@angular/forms": "^16.2.1", "@angular/material": "^16.2.1", "@angular/platform-browser": "^16.2.1", "@badisi/wdio-harness": "^3.0.3", "@types/jest": "^29.5.3", "@typescript-eslint/eslint-plugin": "^6.3.0", "@typescript-eslint/parser": "^6.3.0", "@wdio/cli": "^8.14.6", "@wdio/config": "^8.14.6", "@wdio/cucumber-framework": "^8.14.6", "@wdio/globals": "^8.14.6", "@wdio/local-runner": "^8.14.6", "@wdio/logger": "^8.11.0", "@wdio/spec-reporter": "^8.14.0", "@wdio/static-server-service": "^8.14.0", "eslint": "^8.47.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-import": "^2.28.0", "eslint-plugin-prettier": "^5.0.0", "eslint-plugin-wdio": "^8.8.7", "http-server": "^14.1.1", "jest": "^29.6.2", "jest-circus": "^29.6.2", "npm-run-all": "^4.1.5", "prettier": "^3.0.2", "rxjs": "^7.8.1", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", "typescript": "^5.1.6", "wdio-intercept-service": "^4.4.0", "webdriverio": "^8.14.6", "zone.js": "^0.13.1" }
At runtime, indeed promises are always returned by this plugin function but during compilation i keep getting eslint complaining that "await has no effect on this instruction"....everywhere...
Can you advise ? May I bring more details ?
Sounds like this is a duplicate of https://github.com/webdriverio-community/wdio-intercept-service/issues/229
Hello @christian-bromann , I have the same issue . I can't use this service in TS file.
Unexpected `await` of a non-Promise (non-"Thenable") value.eslint[@typescript-eslint/await-thenable](https://typescript-eslint.io/rules/await-thenable) (method) WebdriverIO.Browser.getRequests(options?: (WdioInterceptorService.GetRequestOptions & WdioInterceptorService.OnlyCompletedRequests) | undefined): WdioInterceptorService.CompletedRequest[] (+1 overload)
My types are correctly configured:
"types": ["node", "@wdio/globals/types", "@wdio/mocha-framework", "@wdio/cucumber-framework", "expect-webdriverio", "wdio-intercept-service"],
I think the types are not correctly seen by typescript
My snippet code:
const requestreturn = await browser.getRequests();
@lacell75 this package does not provide any types. If anyone wants to contribute this, that would be awesome, thank you!
@lacell75 that looks like just an ESLint error, just disable it. It's perfectly fine to await
something that isn't a promise. And indeed, the return value truly is a promise, so your code is correct as-is -- just the lint issue caused by #229
can we have support async/await for wdio-intercept-service