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

jest 27: test failed with beforeEach/afterEach async #10932

Closed
ahnpnl opened this issue Dec 8, 2020 · 6 comments
Closed

jest 27: test failed with beforeEach/afterEach async #10932

ahnpnl opened this issue Dec 8, 2020 · 6 comments

Comments

@ahnpnl
Copy link
Contributor

ahnpnl commented Dec 8, 2020

馃悰 Bug Report

After upgrading to jest@27.0.0-next.2, tests failed. As @SimenB mentioned it might be related to #10644

I have checked about test environment, the tests failed not related to switching test environment to node as default.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Tests in with-nest folder should pass

Link to repl or repo (highly encouraged)

https://github.com/ahnpnl/ts-jest-babel-example/tree/test-fail

envinfo

System:
    OS: macOS 11.0.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 14.15.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.0.14 - /usr/local/bin/npm
  npmPackages:
    jest: ^27.0.0-next.2 => 27.0.0-next.2 
@SimenB
Copy link
Member

SimenB commented Dec 8, 2020

This is not caused by Jest 27 directly, but by switching from jest-jasmine2 to jest-circus. Installing jest-circus@26 and adding testRunner: 'jest-circus/runner' to the config fails using Jest 26.

I haven't investigated if it's a bug in Jasmine or Circus

@ahnpnl
Copy link
Contributor Author

ahnpnl commented Dec 8, 2020

thanks a lot for the information, I can continue to adopt v27 for ts-jest knowing that this is not ts-jest problem.

@SimenB
Copy link
Member

SimenB commented Dec 8, 2020

@ahnpnl I think these are bugs in Jasmine - Jasmine does not report throwing in the hooks or something.

global.gc is not defined unless you expose it (https://github.com/facebook/jest/blob/ca47512c77e6a325bca734a35a4ad15a45dee8aa/packages/jest-leak-detector/src/index.ts#L65-L76). And the app test is a bug in the test

https://github.com/ahnpnl/ts-jest-babel-example/blob/11f1ec13af6af7655c88997160a033c8f90e069f/test/with-nest/test8.spec.ts#L14

you do const app, so the app in the outer scope is never assigned to

@ahnpnl
Copy link
Contributor Author

ahnpnl commented Dec 8, 2020

indeed you are right. Look like jest-jasmine doesn't throw errors like jest-circus which then creates a false positive about "successful" tests.

@SimenB
Copy link
Member

SimenB commented Dec 8, 2020

Closing as duplicate of #9882 then. Thanks for trying 27 out! Please keep reporting any issues 馃檪

@SimenB SimenB closed this as completed Dec 8, 2020
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants