Skip to content

Commit a283009

Browse files
committed
Fix adding await to function arguments
Fixes #20
1 parent f49a1bc commit a283009

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

__testfixtures__/acceptance/visit.input.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ test('visiting /bar', async function(assert) {
2121
await visit('/bar');
2222
assert.equal(currentURL(), '/bar');
2323
});
24+
25+
test('visiting /bar', async function(assert) {
26+
await assert.rejects(visit('/bar'));
27+
assert.equal(currentURL(), '/bar');
28+
});

__testfixtures__/acceptance/visit.output.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ test('visiting /bar', async function(assert) {
1818
await visit('/bar');
1919
assert.equal(currentURL(), '/bar');
2020
});
21+
22+
test('visiting /bar', async function(assert) {
23+
await assert.rejects(visit('/bar'));
24+
assert.equal(currentURL(), '/bar');
25+
});

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ function dropAndThen(j, root) {
500500

501501
function makeAwait(j, collection) {
502502
collection
503-
.filter(({ parent: { node } }) => !j.AwaitExpression.check(node))
503+
.filter(({ parent: { node } }) => j.ExpressionStatement.check(node))
504504
.replaceWith(({ node }) => j.awaitExpression(node))
505505
.forEach((path) => {
506506

0 commit comments

Comments
 (0)