Skip to content

Commit

Permalink
Try finding the leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Jan 4, 2024
1 parent a6263e7 commit d55df6e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/cspell-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"@cspell/dict-python": "^4.1.11",
"@types/configstore": "^6.0.2",
"cspell-dict-nl-nl": "^1.1.2",
"leaked-handles": "^5.2.0",
"lorem-ipsum": "^2.0.8"
}
}
10 changes: 10 additions & 0 deletions packages/cspell-lib/src/lib/leaked-handles.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare module 'leaked-handles' {
export interface Options {
timeout?: number;
fullStack?: boolean;
debugErrors?: boolean;
debugSockets?: boolean;
}

export function set(opts: Options);
}
3 changes: 3 additions & 0 deletions packages/cspell-lib/src/lib/util/resolveFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { parse } from 'comment-json';
import type { VFileSystemProvider } from 'cspell-io';
import { createRedirectProvider, createVirtualFS } from 'cspell-io';
import * as fs from 'fs';
import leakedHandles from 'leaked-handles';
import * as os from 'os';
import * as path from 'path';
import { fileURLToPath, pathToFileURL } from 'url';
Expand Down Expand Up @@ -35,6 +36,8 @@ const rr = {
const oc = expect.objectContaining;
const sm = expect.stringMatching;

leakedHandles.set({ fullStack: true });

describe('Validate resolveFile', () => {
const redirects: [VFileSystemProvider, ...VFileSystemProvider[]] = [
createRedirectProvider('google', new URL('https://google.com/'), notFoundURL),
Expand Down
25 changes: 25 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d55df6e

Please sign in to comment.