-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const reactNativePreset = require('react-native/jest-preset'); | ||
|
||
module.exports = Object.assign({}, reactNativePreset, { | ||
setupFiles: [require.resolve('./save-promise.js')] | ||
.concat(reactNativePreset.setupFiles) | ||
.concat([require.resolve('./restore-promise.js')]), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global.Promise = global.originalPromise; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global.originalPromise = Promise; |
64a7648
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much! This was a time saver. Spent whole day figuring out what did not work on my test code because it was running into timeouts when using fakeTimers("modern") but without me doing any async tests:
Your custom preset helped this test to pass! Thank you very much. I think its time to addres this over at the jest react native package?
64a7648
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I first came across the dreaded,
message in the console many months ago and never understood what caused it. I just accepted it is what it is since all my test suites passed just fine. But always at the back of my mind, it bugged me that the console output wasn't just all green. Now it is all neat and green. π
Thank you.
PS: Is this something that we can expect for the react-native team to take care of or the react-native-testing-library team to take care of in a future update?
64a7648
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much! This saved my day! There are a lot of days that my terminal was red because of this warning! rsrs. Now it is all green β .
But, I'd like to know how you discover this solution? I have now idea what you thought to resolve this problem rsrs.
64a7648
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also tried this in order to get rid of the
act
related warnings, as per: callstack/react-native-testing-library#379 (comment)However, it seems to have broken all our tests. The first failure was related to the
useAppTheme
hook fromreact-native-paper
returningundefined
. Without the patch it works, but the warning is being logged.So, be careful with this approach.