Skip to content

Commit

Permalink
[router]: cancel ExpoRouter SplashScreen during test teardown (#27620)
Browse files Browse the repository at this point in the history
# Why

#27512 is causing extra console logging due to the
`requestAnimationFrame` used by Expo Router to hide the splash screen.
Previously this logic was never invoked as we were using fake timers,
but now we need to cancel the timeout so it doesn't run after the tests
have ended.

# How

Added a `cleanup()` to `expo-router/testing-library` that removes the
`requestAnimationFrame` if it has not run yet.

# Test Plan

<!--
Please describe how you tested this change and how a reviewer could
reproduce your test, especially if this PR does not include automated
tests! If possible, please also provide terminal output and/or
screenshots demonstrating your test/reproduction.
-->

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
  • Loading branch information
marklawlor and expo-bot committed Mar 14, 2024
1 parent 3acde5a commit 99f9d04
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/expo-router/CHANGELOG.md
Expand Up @@ -25,6 +25,7 @@
- Fix incorrect route generation of array shared groups with brackets ([#27459](https://github.com/expo/expo/pull/27459) by [@marklawlor](https://github.com/marklawlor))
- Remove `jest.fakeTimers()` from `expo-router/testing-library` ([#27512](https://github.com/expo/expo/pull/27512) by [@marklawlor](https://github.com/marklawlor))
- Fix incorrect initial URL on web when using baseUrl ([#27287](https://github.com/expo/expo/pull/27287) by [@marklawlor](https://github.com/marklawlor))
- Cancel ExpoRouter SplashScreen during test teardown ([#27620](https://github.com/expo/expo/pull/27620) by [@marklawlor](https://github.com/marklawlor))

### 💡 Others

Expand Down
2 changes: 2 additions & 0 deletions packages/expo-router/build/global-state/router-store.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions packages/expo-router/build/global-state/router-store.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/expo-router/build/testing-library/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/expo-router/build/testing-library/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 99f9d04

Please sign in to comment.