Repository navigation
fix(rbac,sso,billing): silence false error log when @triggerdotdev/plugins is not installed #5102
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,6 +167,31 @@ describe("SSO LazyController", () => { | |
| } | ||
| }); | ||
|
|
||
| it("stays silent when Node ESM reports the missing bare package '@triggerdotdev/plugins'", async () => { | ||
| const previous = process.env.SSO_LOG_FALLBACK; | ||
| delete process.env.SSO_LOG_FALLBACK; | ||
| const importer = vi.fn(async () => { | ||
| const err = Object.assign( | ||
| new Error( | ||
| "Cannot find package '@triggerdotdev/plugins' imported from /triggerdotdev/apps/webapp/build/server/index.js" | ||
| ), | ||
| { code: "ERR_MODULE_NOT_FOUND" } | ||
| ); | ||
| throw err; | ||
| }); | ||
| const errorSpy = vi.spyOn(console, "error").mockImplementation(() => undefined); | ||
|
Comment on lines
+173
to
+182
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 New loader tests use forbidden test doubles The new SSO test uses Learn moreThe repository's testing rules prohibit mocks, spies, stubs, and fakes, including Example: With the optional package absent, a real dynamic import rejects with Node's own error; these tests instead throw a hand-written string through a fake importer. Recommended fix: Exercise the real missing-package import in the loader tests. For log assertions, use an integration-level log capture that does not replace or spy on Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| try { | ||
| const controller = new LazyController(fakePrisma, { importer }); | ||
| expect(await controller.isUsingPlugin()).toBe(false); | ||
| expect(errorSpy).not.toHaveBeenCalled(); | ||
| } finally { | ||
| errorSpy.mockRestore(); | ||
| if (previous === undefined) delete process.env.SSO_LOG_FALLBACK; | ||
| else process.env.SSO_LOG_FALLBACK = previous; | ||
| } | ||
| }); | ||
|
|
||
| it("logs an info line when SSO_LOG_FALLBACK=1", async () => { | ||
| const previous = process.env.SSO_LOG_FALLBACK; | ||
| process.env.SSO_LOG_FALLBACK = "1"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 New SSO test lacks regression annotation
The new SSO test omits the required
// Catches: <bug>comment identifying its distinct regression.Was this helpful? React with 👍 or 👎 to provide feedback.