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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wasm build #1036

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: swiftwasm/swiftwasm-action@v5.4
- uses: swiftwasm/swiftwasm-action@v5.7
6 changes: 6 additions & 0 deletions Sources/Nimble/DSL+AsyncAwait.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#if !os(WASI)
import Dispatch
#endif

private func convertAsyncExpression<T>(_ asyncExpression: () async throws -> T) async -> (() throws -> T) {
let result: Result<T, Error>
Expand Down Expand Up @@ -46,6 +48,8 @@ public func expect(file: FileString = #file, line: UInt = #line, _ expression: (
isClosure: true))
}

#if !os(WASI)

/// Wait asynchronously until the done closure is called or the timeout has been reached.
///
/// @discussion
Expand Down Expand Up @@ -113,3 +117,5 @@ private func throwableUntil(
break
}
}

#endif // #if !os(WASI)
4 changes: 4 additions & 0 deletions Sources/Nimble/Polling+AsyncAwait.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if !os(WASI)

import Dispatch

@MainActor
Expand Down Expand Up @@ -166,3 +168,5 @@ extension SyncExpectation {
return await toAlways(predicate, until: until, pollInterval: pollInterval, description: description)
}
}

#endif // #if !os(WASI)
2 changes: 2 additions & 0 deletions Tests/NimbleTests/StatusTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ final class StatusTest: XCTestCase {
}
}

#if !os(WASI)
func testAsync() {
producesStatus(.passed) {
expect(true).toEventually(beTrue())
Expand All @@ -46,4 +47,5 @@ final class StatusTest: XCTestCase {
expect(true).toEventually(beFalse())
}
}
#endif
}