MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / initDevModeChecks

Function initDevModeChecks

Extension/test/common/internal.ts:52–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50let MAX = 20;
51
52export function initDevModeChecks() {
53 misbehavingPromises = new Set<Promise<any>>();
54
55 try {
56 // eslint-disable-next-line @typescript-eslint/no-var-requires
57 require('mocha').afterAll?.(() => {
58 collectGarbage();
59 console.log("showing!");
60 showActiveHandles();
61 });
62 } catch {
63 // ignore
64 console.log('oops');
65 }
66
67 process.on('unhandledRejection', (reason: any, p) => {
68
69 console.log(`Unhandled Rejection at: Promise ${p} - reason:, ${(reason as any)?.stack ?? reason}`);
70 });
71
72 process.on('multipleResolves', (type, promise, reason) => {
73 if (misbehavingPromises.has(promise)) {
74 return;
75 }
76 if (reason && (reason as any).stack) {
77 console.error((reason as any).stack);
78 return;
79 }
80 if (!MAX--) {
81 throw new Error('MAX MULTIPLE RESOLVED REACHED');
82 }
83 console.error({text: 'Multiple Resolves', type, promise, reason});
84 });
85
86 process.on('exit', showActiveHandles);
87}
88
89initDevModeChecks();

Callers 1

internal.tsFile · 0.85

Calls 5

collectGarbageFunction · 0.90
showActiveHandlesFunction · 0.85
onMethod · 0.80
hasMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected