Steven Hargrove d5aa6d3ff8 Fix for #4943 "Calling an async function with default parameter as function for arguments checking handled synchonous" (#5688)
* moved applying arguments inside new Promise handler block

* updated test fixture to reflect change

* corrected the apply to use correct scope and arguments

* added regression test for issue #4943, added async-to-generator/async-default-arguments test

* added regression test for issue #4943

* switched back to using arrow function, since now pointing to v7 release base branch

* simplified async-to-generator regression test for issue #4943, imrproved change to self/arguments refs by using arrow function on returned promise

* updated text fixtures

* removed es2015 preset usage from issue #4943 regression exec test

* added use strict to test fixture

* added use strict to test fixture

* added destructing transform to test options

* removed use strict from exec test

* added parameters & destructing transforms to test
2017-05-03 21:44:41 -07:00

20 lines
364 B
JavaScript

"use strict";
function mandatory(paramName) {
throw new Error(`Missing parameter: ${paramName}`);
}
async function foo({ a, b = mandatory("b") } = {}) {
return Promise.resolve(b);
}
return (async () => {
assert.doesNotThrow(() => {
foo()
.then(() => {
throw new Error('should not occcur');
})
.catch(() => true);
});
})();