feat(cli): add test for readSocketPath (#4284)

* fix: update isNodeJSErrnoException

* refactor(cli): export and purify readSocketPath

* feat: add tests for readSocketPath

* fix(ci): temporarily disable install deps from cache
This commit is contained in:
Joe Previte
2021-10-29 16:03:57 -07:00
committed by GitHub
parent 49c9c191b9
commit 946e4e8843
4 changed files with 80 additions and 26 deletions

View File

@@ -490,7 +490,7 @@ export function escapeHtml(unsafe: string): string {
* it has a .code property.
*/
export function isNodeJSErrnoException(error: unknown): error is NodeJS.ErrnoException {
return error instanceof Error && (error as NodeJS.ErrnoException).code !== undefined
return error !== undefined && (error as NodeJS.ErrnoException).code !== undefined
}
// TODO: Replace with proper templating system.