Definitelytyped: [@types/jest] Missing Jest Each methods (Jest v23)

Created on 8 Jun 2018  路  5Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [x] I tried using the @types/xxxx package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @JoshuaKGoldberg @bradleyayers

Missing test.each, it.each, describe.each etc, introduced in Jest v23. E.g. below, from the docs

test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
  '.add(%i, %i)',
  (a, b, expected) => {
    expect(a + b).toBe(expected);
  },
);

Most helpful comment

No one replied so I would like to take this issue.

All 5 comments

Anyone is going to work on that? I may help with this one

No one replied so I would like to take this issue.

My PR has been merged, I guess we can close this issue.

The types as they are now miss the optional timeout parameter, e.g. this reports an error:
it.each([])('', () => {}, 5e3);
It should be something like

interface Each {
        (cases: any[]): (name: string, fn: (...args: any[]) => any, timeout?: number) => void;
        (strings: TemplateStringsArray, ...placeholders: any[]): (
            name: string,
            fn: (arg: any) => any,
            timeout?: number,
        ) => void;
    }

This should probably be closed now

Was this page helpful?
0 / 5 - 0 ratings