🐛 Bug Report
The return type of test.each is void | ((title: string, test: EachTestFn<TestFn>, timeout?: number | undefined) => void).
It should not include void, as this makes the result uncallable.
To Reproduce
With Jest v26.4.2 and Typescript v4.0.2, create each.test.ts.
import { expect, test } from '@jest/globals';
const items = test.each([['foo'], ['bar']]);
items('Test %s', item => {
expect(item).toHaveProperty('length', 3);
});
test.each`
item
foo
bar
`(item => {
expect(item).toHaveProperty('length', 3);
});
Steps to reproduce the behavior:
tsc produces:
each.test.ts:5:1 - error TS2349: This expression is not callable.
Not all constituents of type 'void | ((title: string, test: EachTestFn<TestFn>, timeout?: number | undefined) => void)' are callable.
Type 'void' has no call signatures.
5 items('Test %s', item => {
~~~~~
each.test.ts:9:1 - error TS2349: This expression is not callable.
Not all constituents of type 'void | ((title: string, test: EachTestFn<TestFn>, timeout?: number | undefined) => void)' are callable.
Type 'void' has no call signatures.
9 test.each`
~~~~~~~~~~
10 item
~~~~~~
...
12 bar
~~~
13 `(item => {
~
Found 2 errors.
Expected behavior
The given tests should compile.
envinfo
System:
OS: macOS 10.15.6
CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
Binaries:
Node: 14.8.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.7 - /usr/local/bin/npm
npmPackages:
jest: ^26.4.2 => 26.4.2
🐛 Bug Report
The return type of
test.eachisvoid | ((title: string, test: EachTestFn<TestFn>, timeout?: number | undefined) => void).It should not include
void, as this makes the result uncallable.To Reproduce
With Jest v26.4.2 and Typescript v4.0.2, create
each.test.ts.Steps to reproduce the behavior:
tscproduces:Expected behavior
The given tests should compile.
envinfo