Support util.promisify on installed functions
kevinoid opened this issue · 0 comments
kevinoid commented
- FakeTimers version : 6.0.1
- Environment : Node v15.5.1
What did you expect to happen?
util.promisify
would work on setTimeout
installed by FakeTimers as it does on the global setTimeout
.
What actually happens
The Promise returned by the installed setTimeout
is never resolved because the installed setTimeout
does not have a promisify.custom
symbol property.
How to reproduce
const { promisify } = require('util');
const FakeTimers = require("@sinonjs/fake-timers");
console.log('initial global.setTimeout', setTimeout[promisify.custom]);
const target = { Date };
FakeTimers.install({ target });
console.log('installed target.setTimeout', target.setTimeout[promisify.custom]);
FakeTimers.install();
console.log('installed global.setTimeout', setTimeout[promisify.custom]);
prints
initial global.setTimeout [Function]
installed target.setTimeout undefined
installed global.setTimeout undefined
Discussion
This issue was noted by @joshua-barnett in #292 (comment). I'm opening this issue to track it.