Git Product home page Git Product logo

Comments (7)

christian-bromann avatar christian-bromann commented on July 3, 2024 1

Can you explained in a bit more detail what you mean by that?

from wdio-intercept-service.

tehhowch avatar tehhowch commented on July 3, 2024

@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.

from wdio-intercept-service.

Grobouls avatar Grobouls commented on July 3, 2024

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 ?

from wdio-intercept-service.

tehhowch avatar tehhowch commented on July 3, 2024

Sounds like this is a duplicate of #229

from wdio-intercept-service.

lacell75 avatar lacell75 commented on July 3, 2024

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();

from wdio-intercept-service.

christian-bromann avatar christian-bromann commented on July 3, 2024

@lacell75 this package does not provide any types. If anyone wants to contribute this, that would be awesome, thank you!

from wdio-intercept-service.

tehhowch avatar tehhowch commented on July 3, 2024

@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

from wdio-intercept-service.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.