Skip to content

Commit

Permalink
Supress warning
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Nov 27, 2024
1 parent 60a9df7 commit 01afee9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@tsconfig/node20": "^20.1.4",
"@types/node": "^22.10.0",
"chai": "^5.1.2",
"dotenv": "^16.4.5",
"typescript": "^5.7.2",
"vitest": "^2.1.6"
},
Expand Down
10 changes: 10 additions & 0 deletions src/apns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export class ApnsClient extends EventEmitter {
maxConcurrentStreams: 100,
})
this._token = null
this._supressH2Warning()
}

sendMany(notifications: Notification[]) {
Expand Down Expand Up @@ -156,4 +157,13 @@ export class ApnsClient extends EventEmitter {

return token
}

private _supressH2Warning() {
process.once("warning", (warning: Error & { code?: string }) => {
if (warning.code === "UNDICI-H2") {
return
}
process.emit("warning", warning)
})
}
}
1 change: 1 addition & 0 deletions test/apns2.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "dotenv/config"
import { assert } from "chai"
import { beforeAll, describe, it } from "vitest"
import { ApnsClient, Errors, Notification, SilentNotification } from "../src"
Expand Down

0 comments on commit 01afee9

Please sign in to comment.