MCPcopy Index your code
hub / github.com/nodejs/node / getCurrentTimersDescriptors

Function getCurrentTimersDescriptors

test/parallel/test-runner-mock-timers.js:63–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 it('should check that propertyDescriptor gets back after resetting timers', (t) => {
62 const getDescriptor = (ctx, fn) => Object.getOwnPropertyDescriptor(ctx, fn);
63 const getCurrentTimersDescriptors = () => {
64 const timers = [
65 'setTimeout',
66 'clearTimeout',
67 'setInterval',
68 'clearInterval',
69 'setImmediate',
70 'clearImmediate',
71 ];
72
73 const globalTimersDescriptors = timers.map((fn) => getDescriptor(globalThis, fn));
74 const nodeTimersDescriptors = timers.map((fn) => getDescriptor(nodeTimers, fn));
75 const nodeTimersPromisesDescriptors = timers
76 .filter((fn) => !fn.includes('clear'))
77 .map((fn) => getDescriptor(nodeTimersPromises, fn));
78
79 return {
80 global: globalTimersDescriptors,
81 nodeTimers: nodeTimersDescriptors,
82 nodeTimersPromises: nodeTimersPromisesDescriptors,
83 };
84 };
85
86 const originalDescriptors = getCurrentTimersDescriptors();
87

Callers 1

Calls 4

getDescriptorFunction · 0.85
includesMethod · 0.80
mapMethod · 0.65
filterMethod · 0.65

Tested by

no test coverage detected