Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support jest 27 #674

Closed
ahnpnl opened this issue Dec 17, 2020 · 5 comments 路 Fixed by #676
Closed

Support jest 27 #674

ahnpnl opened this issue Dec 17, 2020 · 5 comments 路 Fixed by #676
Labels
馃殌 Feature Request new suggested feature

Comments

@ahnpnl
Copy link
Collaborator

ahnpnl commented Dec 17, 2020

馃殌 Feature Proposal

Adopt ts-jest v27 and jest 27 changes

Notes

@ahnpnl ahnpnl added the 馃殌 Feature Request new suggested feature label Dec 17, 2020
@ahnpnl ahnpnl mentioned this issue Dec 17, 2020
2 tasks
@ahnpnl
Copy link
Collaborator Author

ahnpnl commented Dec 17, 2020

Hi @JiaLiPassion , we have issues with zone 10 with jest 27. The error is thrown for async done =>

Error: Test functions cannot both take a 'done' callback and return something. Either use a 'done' callback, or return a promise.
    Returned value: ZoneAwarePromise {
"__zone_symbol__state": true,
"__zone_symbol__value": undefined,
}

Would you please help to check it ? Here is the CI which has the test failed https://github.com/thymikee/jest-preset-angular/pull/676/checks?check_run_id=1570469754

@ahnpnl ahnpnl modified the milestone: 9.0.0 Dec 17, 2020
@JiaLiPassion
Copy link
Contributor

@ahnpnl , sure , I will check it.

@ahnpnl
Copy link
Collaborator Author

ahnpnl commented Dec 17, 2020

FYI: The issue is caused by default testRunner in Jest 27 is jest-circus, switch back to jest-jasmine2 the test passed again. I think this information is helpful

@ahnpnl ahnpnl mentioned this issue Dec 17, 2020
2 tasks
@JiaLiPassion
Copy link
Contributor

@ahnpnl , I just checked, I think it is not a zone.js or jest-preset-angular issue.
I created an empty project with single test file.

describe('test fake', () => {
  it('async with done should work', async done => {
    let flag = false;
    setTimeout(() => {
      flag = true;
      expect(flag).toBe(true);
      done();
    }, 100);
  });
});

And use jest 27 to run it, it will throw the same error. So it seems jest-circus not allow to
use done with return something at the same time.
jestjs/jest#10529

@ahnpnl
Copy link
Collaborator Author

ahnpnl commented Dec 17, 2020

I see, thanks a lot 馃憤 I will set to jest-jasmine2 for now while waiting for Jest to fix it.

@ahnpnl ahnpnl pinned this issue Dec 17, 2020
@ahnpnl ahnpnl unpinned this issue May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃殌 Feature Request new suggested feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants