Content-Length: 242197 | pFad | https://github.com/angular/angular/issues/61717

3D Test wrapped in waitForAsync does not receive parameterized values from jest it.each · Issue #61717 · angular/angular · GitHub
Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
timhonermann opened this issue May 28, 2025 · 0 comments · May be fixed by #61755
Open

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

timhonermann opened this issue May 28, 2025 · 0 comments · May be fixed by #61755
Labels
area: testing Issues related to Angular testing features, such as TestBed area: zones Issues related to zone.js
Milestone

Comments

@timhonermann
Copy link

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

@JeanMeche JeanMeche added area: testing Issues related to Angular testing features, such as TestBed area: zones Issues related to zone.js labels May 28, 2025
@ngbot ngbot bot modified the milestone: needsTriage May 28, 2025
@timhonermann timhonermann changed the title Test wrapped in waitForAsync does not receive parametrized values from jest it.each Test wrapped in waitForAsync does not receive parameterized values from jest it.each May 28, 2025
atscott added a commit to atscott/angular that referenced this issue May 29, 2025
This ensures that test functions with arguments (e.g. `it.each` in jest)
are forwarded to the test function. This does not apply to jasmine,
which assumes the only arguments needed would be the `done` function.

fixes angular#61717
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: testing Issues related to Angular testing features, such as TestBed area: zones Issues related to zone.js
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/angular/angular/issues/61717

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy