Skip to content

Commit 830949a

Browse files
Wording fixes and mention CLI options on WebAssembly testing
1 parent 39cc537 commit 830949a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Sources/Testing/Testing.docc/TemporaryGettingStarted.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ section of
148148
#### Running tests for WebAssembly
149149

150150
To run tests for WebAssembly, install a Swift SDK for WebAssembly by following
151-
[the instructions](https://book.swiftwasm.org/getting-started/setup-snapshot.html).
151+
[these instructions](https://book.swiftwasm.org/getting-started/setup-snapshot.html).
152152

153153
Because `swift test` doesn't know what WebAssembly environment you'd like to use
154154
to run your tests, building tests and running them are two separate steps. To
@@ -159,11 +159,20 @@ swift build --swift-sdk wasm32-unknown-wasi --build-tests
159159
```
160160

161161
After building tests, you can run them using a [WASI](https://wasi.dev/)-compliant
162-
WebAssembly runtime, such as [Wasmtime](https://wasmtime.dev/) or
162+
WebAssembly runtime such as [Wasmtime](https://wasmtime.dev/) or
163163
[WasmKit](https://github.com/swiftwasm/WasmKit). For example, to run tests using
164164
Wasmtime, use the following command (replace `{YOURPACKAGE}` with your package's
165165
name):
166166

167167
```sh
168168
wasmtime .build/debug/{YOURPACKAGE}PackageTests.wasm
169169
```
170+
171+
Most WebAssembly runtimes forward trailing arguments to the WebAssembly program,
172+
so you can pass command-line options of the testing library. For example, to list
173+
all tests and filter them by name, use the following commands:
174+
175+
```sh
176+
wasmtime .build/debug/{YOURPACKAGE}PackageTests.wasm --list-tests
177+
wasmtime .build/debug/{YOURPACKAGE}PackageTests.wasm --filter "FoodTruckTests.foodTruckExists"
178+
```

0 commit comments

Comments
 (0)