Jest-puppeteer: Provide TypeScript typings?

Created on 7 Mar 2018  路  10Comments  路  Source: smooth-code/jest-puppeteer

I'm going to be using this in a TypeScript app. It'd be convenient if the types for this library came with it and were updated alongside source.

Alternately, I can just put them in https://github.com/DefinitelyTyped/DefinitelyTyped/. Thoughts?

All 10 comments

I would like to have it in repository, if you could submit a PR to add it to expect-puppeteer it would be awesome.

I am not a TypeScript user that's why the library is not yet TypeScript friendly. I count on you for that!

If you're not a TypeScript user it'd probably be easier to put them into DT - that way the automated systems there can take care of update procedures & getting reviewers involved. I'll tag you in a PR. Thanks!

@JoshuaKGoldberg OK, good for me.

Both PRs completed! Types should be available within an hour or three under:

http://npmjs.com/package/@types/expect-puppeteer
http://npmjs.com/package/@types/jest-environment-puppeteer

Thanks! If you want to avoid conflict, you can use expectPuppeteer and expect to have the correct type, see #26.

@JoshuaKGoldberg I think the definition for toMatchElement() is wrong.

Currently:

toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise<void>;

Should be:

toMatchElement(selector: string, options?: ExpectToClickOptions): Promise<void>; 

so can be used like this:

await expect(page).toMatchElement('e2e-attribute-basic .single', { text: 'Single' });

At the moment it always passes the test.

@tja4472 yes toMatchElement(selector: string, options?: ExpectToClickOptions): Promise<void>; is actually the correct signature.

Good catch, whoops. If you file an issue on DefinitelyTyped we can resolve it there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

undrafted picture undrafted  路  4Comments

FezVrasta picture FezVrasta  路  4Comments

macabeus picture macabeus  路  4Comments

melissachang picture melissachang  路  6Comments

alexander-elgin picture alexander-elgin  路  4Comments