From e6758073bc3115f13a028accaae84d3023f2e48e Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Wed, 22 Nov 2017 21:11:13 -0500 Subject: [PATCH] Note Promise-awareness of Tinytest.addAsync in tinytest/README.md. --- packages/tinytest/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/tinytest/README.md b/packages/tinytest/README.md index b02d391603..8f5deec74b 100644 --- a/packages/tinytest/README.md +++ b/packages/tinytest/README.md @@ -128,6 +128,18 @@ Tinytest.addAsync(name, (test, onComplete) => { }); ``` +You can avoid having to call the `onComplete` callback explicitly by +returning a `Promise` from the test function, which conveniently enables +`async` test functions: + +```javascript +Tinytest.addAsync(name, async (test) => { + test.equal(shouldReturnFoo(), "foo"); + const bar = await shouldReturnBarAsync(); + test.equal(bar, "bar"); +}); +``` + ## Executing the Tests Tests are executed by running the (development) application with the `test-packages` command. By default, all packages are tested, but specific packages can be tested by specifying them by name.