Skip to content

Test wrapped in waitForAsync does not receive parameterized values from jest it.each #61717

Closed
@timhonermann

Description

@timhonermann

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

Yes

Description

When a parameterized jest test, with it.each is wrapped in a waitForAsync all the parameterized values are passed to the test asundefined.

If the test is not wrapped in waitForAsync the parameterized values are passed correctly.

// values are passed as undefined

it.each([
      ['first', 1],
      ['second', 2],
      ['third', 3],
    ])(
      'My Test %s %s',
      waitForAsync((param1: string, param2: number) => {
        console.log('param1', param1) // undefined;
        console.log('param2', param2) // undefined;

        ...
      }),
    );

When using a normal array to iterate over parameters it seems to work fine.

// Values are passed properly

[
      { param1: 'first', param2: 1 },
      { param1: 'second', param2: 2 },
      { param1: 'third', param2: 3 },
    ].forEach(({ param1, param2 }) => {
      it(`My test with params ${param1} and ${param2}`, waitForAsync(() => {
        console.log('param1', param1) // 'first' | 'second' | 'third';
        console.log('param2', param2); // 1 | 2 | 3

        ...
      }))
    });

Please provide a link to a minimal reproduction of the bug

https://github.com/timhonermann/it-each-wait-for-async-issue/blob/main/README.md

Please provide the exception or error you saw

No error or exception.

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.2.13
Node: 22.2.0
Package Manager: npm 10.7.0
OS: linux x64

Angular: 19.2.13
... cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.13
@angular-devkit/build-angular   19.2.13
@angular-devkit/core            19.2.13
@angular-devkit/schematics      19.2.13
@schematics/angular             19.2.13
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: testingIssues related to Angular testing features, such as TestBedarea: zonesIssues related to zone.js

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions