Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extension function fallbacks #557

Merged
merged 2 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "fix"
---

Fix the extension function fallbacks on installation failure. When the extension fails to install and calls are made to the unloaded functions, it will no longer throw an error.
11 changes: 11 additions & 0 deletions packages/nodejs/src/__tests__/extension.failure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ describe("Extension", () => {
ext.stop()
}).not.toThrow()
})

it("does not error on diagnoseRaw", () => {
expect(ext.diagnose()).toMatchObject({
error: expect.any(Error),
output: [""]
})
})

it("does not error on runningInContainer", () => {
expect(ext.runningInContainer()).toBeUndefined()
})
})
2 changes: 1 addition & 1 deletion packages/nodejs/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Extension {
} catch (error) {
return {
error: error,
output: diagnostics_report_string.split("\n")
output: (diagnostics_report_string || "").split("\n")
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/nodejs/src/extension_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ try {
start() {
throw new Error("Extension module not loaded")
},
stop() {
return
}
stop() {},
diagnoseRaw() {},
runningInContainer() {}
}
} as ExtensionWrapper
}
Expand Down