test: Switch from leaked-handles to wtfnode (#2604)
See my comments at https://github.com/cdr/code-server/pull/2563#issuecomment-763394741
This commit is contained in:
parent
5446e0ad43
commit
d7f06975a6
@ -47,6 +47,7 @@
|
||||
"@types/tar-fs": "^2.0.0",
|
||||
"@types/tar-stream": "^2.1.0",
|
||||
"@types/ws": "^7.2.6",
|
||||
"@types/wtfnode": "^0.7.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.7.0",
|
||||
"@typescript-eslint/parser": "^4.7.0",
|
||||
"doctoc": "^1.4.0",
|
||||
@ -61,6 +62,7 @@
|
||||
"stylelint": "^13.0.0",
|
||||
"stylelint-config-recommended": "^3.0.0",
|
||||
"ts-node": "^9.0.0",
|
||||
"wtfnode": "^0.8.4",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"resolutions": {
|
||||
|
@ -1,14 +1,16 @@
|
||||
import { field, logger } from "@coder/logger"
|
||||
import * as fs from "fs-extra"
|
||||
import "leaked-handles"
|
||||
import * as net from "net"
|
||||
import * as path from "path"
|
||||
import * as tls from "tls"
|
||||
import { Emitter } from "../src/common/emitter"
|
||||
import { SocketProxyProvider } from "../src/node/socket"
|
||||
import { generateCertificate, tmpdir } from "../src/node/util"
|
||||
import * as wtfnode from "./wtfnode"
|
||||
|
||||
describe("SocketProxyProvider", () => {
|
||||
wtfnode.setup()
|
||||
|
||||
const provider = new SocketProxyProvider()
|
||||
|
||||
const onServerError = new Emitter<{ event: string; error: Error }>()
|
||||
|
19
test/wtfnode.ts
Normal file
19
test/wtfnode.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import * as wtfnode from "wtfnode"
|
||||
|
||||
let active = false
|
||||
|
||||
export function setup(): void {
|
||||
if (active) {
|
||||
return
|
||||
}
|
||||
active = true
|
||||
|
||||
const interval = 5000
|
||||
const wtfnodeDump = () => {
|
||||
wtfnode.dump()
|
||||
const t = setTimeout(wtfnodeDump, interval)
|
||||
t.unref()
|
||||
}
|
||||
const t = setTimeout(wtfnodeDump, interval)
|
||||
t.unref()
|
||||
}
|
10
yarn.lock
10
yarn.lock
@ -1201,6 +1201,11 @@
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/wtfnode@^0.7.0":
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/wtfnode/-/wtfnode-0.7.0.tgz#e5d9c675bccc2f786830ffa40ffe8865f92057d9"
|
||||
integrity sha512-kdBHgE9+M1Os7UqWZtiLhKye5reFl8cPBYyCsP2fatwZRz7F7GdIxIHZ20Kkc0hYBfbXE+lzPOTUU1I0qgjtHA==
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^4.7.0":
|
||||
version "4.7.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.7.0.tgz#85c9bbda00c0cb604d3c241f7bc7fb171a2d3479"
|
||||
@ -8022,6 +8027,11 @@ ws@^7.2.0:
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8"
|
||||
integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==
|
||||
|
||||
wtfnode@^0.8.4:
|
||||
version "0.8.4"
|
||||
resolved "https://registry.yarnpkg.com/wtfnode/-/wtfnode-0.8.4.tgz#91ecf78a40ce222a73a063f26d72bea52357efcc"
|
||||
integrity sha512-64GEKtMt/MUBuAm+8kHqP74ojjafzu00aT0JKsmkIwYmjRQ/odO0yhbzKLm+Z9v1gMla+8dwITRKzTAlHsB+Og==
|
||||
|
||||
x-is-string@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/x-is-string/-/x-is-string-0.1.0.tgz#474b50865af3a49a9c4657f05acd145458f77d82"
|
||||
|
Reference in New Issue
Block a user