LironEr / cypress-mochawesome-reporter

Zero config Mochawesome reporter for Cypress with screenshots and videos
MIT License
159 stars 49 forks source link

declare addTestContext in Cypress namespace #127

Closed joakim-sch closed 1 year ago

joakim-sch commented 1 year ago

Is your feature request related to a problem? Please describe. My issue was that my cypress project written in typescript did not recognize addTestContext() addTestContext not recognized

Describe the solution you'd like Declare the function;

declare namespace Cypress {
    interface Chainable {
        addTestContext(context: string | object): void;
    }
}

Describe alternatives you've considered Update doc/readme to include instruction on typescript declaration for TS users

Additional context The addTestContext seems not to be documented in this repository documentation and could use a mention nonetheless. I'll happily make a PR myself, just want your input on the solution. And if you have a preference where to declare it should you agree to the solution :)

LironEr commented 1 year ago

I think you can create a types file like https://github.com/testing-library/cypress-testing-library/blob/main/types/index.d.ts

Also, it will be good to add it to the docs

Feel free to create a PR (:

joakim-sch commented 1 year ago

@LironEr Submitted PR: https://github.com/LironEr/cypress-mochawesome-reporter/pull/131

LironEr commented 1 year ago

Thanks @joakim-sch

Released in v3.3.0