Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Aug 21, 2023
1 parent f147226 commit 23516c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions integration/error-sanitization-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,11 @@ test.describe("Error Sanitization", () => {
) {
console.error("App Specific Error Logging:");
console.error(" Request: " + request.method + " " + request.url);
if (error instanceof Error) {
if (isRouteErrorResponse(error)) {
console.error(" Status: " + error.status + " " + error.statusText);
console.error(" Error: " + error.error.message);
console.error(" Stack: " + error.error.stack);
} else if (error instanceof Error) {
console.error(" Error: " + error.message);
console.error(" Stack: " + error.stack);
} else {
Expand Down Expand Up @@ -647,11 +651,12 @@ test.describe("Error Sanitization", () => {
expect(errorLogs[1][0]).toEqual(
" Request: GET test://test/?_data=not-a-route"
);
expect(errorLogs[2][0]).toEqual(
expect(errorLogs[2][0]).toEqual(" Status: 403 Forbidden");
expect(errorLogs[3][0]).toEqual(
' Error: Route "not-a-route" does not match URL "/"'
);
expect(errorLogs[3][0]).toMatch(" at ");
expect(errorLogs.length).toBe(4);
expect(errorLogs[4][0]).toMatch(" at ");
expect(errorLogs.length).toBe(5);
});
});
});
2 changes: 1 addition & 1 deletion packages/remix-server-runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const createRequestHandler: CreateRequestHandlerFunction = (
build.entry.module.handleError ||
((error, { request }) => {
if (serverMode !== ServerMode.Test && !request.signal.aborted) {
console.error(error);
console.error(isRouteErrorResponse(error) ? error.error : error);
}
});

Expand Down

0 comments on commit 23516c9

Please sign in to comment.