Skip to content

Conversation

@HubertBer
Copy link
Collaborator

Why

New expo blob implementation requires comprehensive tests to help with it's development and to verify that it matches the original JS implementation.

How

I've copied and modified tests from web-platform-tests. I've added them to apps/test-suite.

Test Plan

The tests were run on android simulator through bare-expo. They show up properly. Some of the tests fail, but it's intended as they are to help with the implementation. Not every test is finished yet, some need to be modified.

Checklist

@aleqsio
Copy link

aleqsio commented Jul 22, 2025

Love this!

@jakex7 jakex7 merged commit cdeaec3 into main Jul 22, 2025
@jakex7 jakex7 deleted the @HubertBer/blob-tests branch July 22, 2025 11:22
HubertBer pushed a commit that referenced this pull request Dec 4, 2025
# Why

Ran into an issue with background tasks (triggered by a background
notification):

<details>
<summary>Details</summary>

```
(lldb) bt
* thread #19, queue = 'expo.application.remoteNotification', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1038578e4)
    frame #0: 0x00000001038578e4 libdispatch.dylib`_dispatch_assert_queue_fail + 120
    frame #1: 0x000000010388e01c libdispatch.dylib`dispatch_assert_queue$V2.cold.1 + 116
    frame #2: 0x0000000103857868 libdispatch.dylib`dispatch_assert_queue + 108
    frame #3: 0x000000018996003c libswift_Concurrency.dylib`_swift_task_checkIsolatedSwift + 48
    frame #4: 0x00000001899bf724 libswift_Concurrency.dylib`swift_task_isCurrentExecutorWithFlagsImpl(swift::SerialExecutorRef, swift::swift_task_is_current_executor_flag) + 356
    frame #5: 0x00000001050e6678 notificationtester.debug.dylib`closure #1 in closure #2 in static ExpoAppDelegateSubscriberManager.application(result=.noData, failedCount=0, newDataCount=0, 
subscribersLeft=2, completionHandler=0x0000000104f6dea8 notificationtester.debug.dylib`partial apply forwarder for reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned 
__C.UIBackgroundFetchResult) -> () to @escaping @callee_guaranteed (@unowned __C.UIBackgroundFetchResult) -> () at <compiler-generated>) at ExpoAppDelegateSubscriberManager.swift:0
    frame #8: 0x000000010386e2e0 libdispatch.dylib`_dispatch_client_callout + 16
    frame #9: 0x00000001038653cc libdispatch.dylib`_dispatch_lane_barrier_sync_invoke_and_complete + 172
  * frame #10: 0x00000001050e650c notificationtester.debug.dylib`closure #2 in static ExpoAppDelegateSubscriberManager.application(result=.noData, dispatchQueue=0x000000012c455d80, failedCount=0, 
newDataCount=0, subscribersLeft=2, completionHandler=0x0000000104f6dea8 notificationtester.debug.dylib`partial apply forwarder for reabstraction thunk helper from @escaping @callee_unowned @convention(block)
 (@unowned __C.UIBackgroundFetchResult) -> () to @escaping @callee_guaranteed (@unowned __C.UIBackgroundFetchResult) -> () at <compiler-generated>) at ExpoAppDelegateSubscriberManager.swift:225:21
    frame #12: 0x0000000104f6bad8 notificationtester.debug.dylib`__94-[EXLegacyAppDelegateWrapper 
application:didReceiveRemoteNotification:fetchCompletionHandler:]_block_invoke(.block_descriptor=0x0000000120206340, result=UIBackgroundFetchResultNoData) at EXLegacyAppDelegateWrapper.m:212:9
    frame #13: 0x0000000104f65064 notificationtester.debug.dylib`__63-[EXTaskService runTasksWithReason:userInfo:completionHandler:]_block_invoke(.block_descriptor=0x000000012bbebc90, results=@"1 element") 
at EXTaskService.m:351:7
    frame #14: 0x0000000104f666f8 notificationtester.debug.dylib`__67-[EXTaskService _runTasksSupportingLaunchReason:userInfo:callback:]_block_invoke(.block_descriptor=0x0000000120204f80, results=@"1 
element") at EXTaskService.m:517:7
    frame #15: 0x0000000104f60cdc notificationtester.debug.dylib`-[EXTaskExecutionRequest _maybeExecuteCallback](self=0x000000012c519b60, _cmd="_maybeExecuteCallback") at EXTaskExecutionRequest.m:59:5
    frame #16: 0x0000000104f60c74 notificationtester.debug.dylib`-[EXTaskExecutionRequest maybeEvaluate](self=0x000000012c519b60, _cmd="maybeEvaluate") at EXTaskExecutionRequest.m:46:5
    frame #17: 0x0000000104f60b98 notificationtester.debug.dylib`-[EXTaskExecutionRequest task:didFinishWithResult:](self=0x000000012c519b60, _cmd="task:didFinishWithResult:", task=0x0000000120370840, 
result=(long)1) at EXTaskExecutionRequest.m:35:3
    frame #18: 0x0000000104f63e64 notificationtester.debug.dylib`-[EXTaskService notifyTaskWithName:forAppId:didFinishWithResponse:](self=0x00000001200014c0, 
_cmd="notifyTaskWithName:forAppId:didFinishWithResponse:", taskName=@"BACKGROUND_NOTIFICATION_TASK", appId=@"mainApplication", response=1 key/value pair) at EXTaskService.m:217:7
    frame #19: 0x0000000104f617c4 notificationtester.debug.dylib`-[EXTaskManager notifyTaskFinished:withResponse:resolve:reject:](self=0x0000000120371600, 
_cmd="notifyTaskFinished:withResponse:resolve:reject:", taskName=@"BACKGROUND_NOTIFICATION_TASK", response=1 key/value pair, resolve=0x000000010ad20e7c, reject=0x000000010ad213bc) at EXTaskManager.m:104:3
    frame #20: 0x000000018b4ee6c4 CoreFoundation`__invoking___ + 148
    frame #21: 0x000000018b4ee550 CoreFoundation`-[NSInvocation invoke] + 424
    frame #22: 0x0000000105015b5c notificationtester.debug.dylib`-[EXExportedModule callExportedMethod:withArguments:resolver:rejecter:](self=0x0000000120371600, 
_cmd="callExportedMethod:withArguments:resolver:rejecter:", methodName=@"notifyTaskFinishedAsync", arguments=@"2 elements", resolve=0x000000010ad20e7c, reject=0x000000010ad213bc) at EXExportedModule.m:168:3
    frame #23: 0x000000010501fa10 notificationtester.debug.dylib`__79-[EXNativeModulesProxy callMethod:methodNameOrKey:arguments:resolver:rejecter:]_block_invoke(.block_descriptor=0x0000000122ea9270) at 
EXNativeModulesProxy.mm:243:7
    frame #24: 0x000000010385463c libdispatch.dylib`_dispatch_call_block_and_release + 32
    frame #25: 0x000000010386e2e0 libdispatch.dylib`_dispatch_client_callout + 16
    frame expo#26: 0x000000010385cb4c libdispatch.dylib`_dispatch_lane_serial_drain + 796
    frame expo#27: 0x000000010385d7d4 libdispatch.dylib`_dispatch_lane_invoke + 432
    frame expo#28: 0x0000000103869b20 libdispatch.dylib`_dispatch_root_queue_drain_deferred_wlh + 344
    frame expo#29: 0x00000001038691c4 libdispatch.dylib`_dispatch_workloop_worker_thread + 752
    frame expo#30: 0x00000001e7d803b8 libsystem_pthread.dylib`_pthread_wqthread + 292
```

</details>

# How

- dispatch the completion handlers on main queue

# Test Plan

- tested locally with notification-tester app

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
-->

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants