Fix 'Unhandled promise rejection (rejection id: 1): ReferenceError: setTimeout is not defined' warning.

This commit is contained in:
Logan Smyth
2017-05-05 13:57:31 -07:00
parent 14584c218c
commit 6646707e01
2 changed files with 5 additions and 9 deletions

View File

@@ -20,6 +20,8 @@ const testContext = vm.createContext({
...helpers,
assert: chai.assert,
transform: babel.transform,
setTimeout: setTimeout,
setImmediate: setImmediate,
});
testContext.global = testContext;

View File

@@ -8,12 +8,6 @@ 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);
});
})();
return foo().then(() => {
throw new Error('should not occcur');
}, () => true);