Skip to content

Commit

Permalink
Merge pull request #124 from Turbo87/async/await
Browse files Browse the repository at this point in the history
README: Add instructions for a world with async/await
  • Loading branch information
Turbo87 authored Dec 12, 2016
2 parents ceed29b + 61cfac2 commit 9672684
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('Contact', function() {
```


#### Acceptance Tests
### Acceptance Tests

The `setupAcceptanceTest` function can be used to run acceptance
tests as the name suggests. It will automatically setup an
Expand Down Expand Up @@ -176,6 +176,22 @@ also add `return wait();` to the end of your acceptance tests.
While this currently still works without the `return`, it will fail once
this library is updated to Mocha 3.x!

#### Using `async/await`

In case your project supports the `async/await` feature of ES2016 you can
simplify the test function to this:

```js
it('can visit /', async function() {
await visit('/');
expect(currentURL()).to.equal('/');
});
```

- add the `async` keyword in front of the test `function`
- add `await` in front of all async test helper calls
- remove the `andThen()` wrappers


Upgrading
------------------------------------------------------------------------------
Expand Down

0 comments on commit 9672684

Please sign in to comment.