Skip to content

Commit 5813c1e

Browse files
authored
silence remaining expected errors from integration tests (#12457)
1 parent 722d488 commit 5813c1e

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

integration/catch-boundary-test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { PlaywrightFixture } from "./helpers/playwright-fixture.js";
1111
test.describe("ErrorBoundary (thrown responses)", () => {
1212
let fixture: Fixture;
1313
let appFixture: AppFixture;
14+
let originalConsoleError: typeof console.error;
15+
let originalConsoleWarn: typeof console.warn;
1416

1517
let ROOT_BOUNDARY_TEXT = "ROOT_TEXT" as const;
1618
let OWN_BOUNDARY_TEXT = "OWN_BOUNDARY_TEXT" as const;
@@ -214,10 +216,16 @@ test.describe("ErrorBoundary (thrown responses)", () => {
214216
});
215217

216218
appFixture = await createAppFixture(fixture);
219+
originalConsoleError = console.error;
220+
console.error = () => {};
221+
originalConsoleWarn = console.warn;
222+
console.warn = () => {};
217223
});
218224

219225
test.afterAll(() => {
220226
appFixture.close();
227+
console.error = originalConsoleError;
228+
console.warn = originalConsoleWarn;
221229
});
222230

223231
test("non-matching urls on document requests", async () => {

integration/fs-routes-test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212

1313
let fixture: Fixture;
1414
let appFixture: AppFixture;
15+
let originalConsoleError: typeof console.error;
16+
let originalConsoleWarn: typeof console.warn;
1517

1618
test.describe("fs-routes", () => {
1719
test.beforeAll(async () => {
@@ -138,10 +140,16 @@ test.describe("fs-routes", () => {
138140
});
139141

140142
appFixture = await createAppFixture(fixture);
143+
originalConsoleError = console.error;
144+
console.error = () => {};
145+
originalConsoleWarn = console.warn;
146+
console.warn = () => {};
141147
});
142148

143149
test.afterAll(() => {
144150
appFixture.close();
151+
console.error = originalConsoleError;
152+
console.warn = originalConsoleWarn;
145153
});
146154

147155
test.describe("without JavaScript", () => {

integration/resource-routes-test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ test.describe("loader in an app", async () => {
1313
let appFixture: AppFixture;
1414
let fixture: Fixture;
1515
let _consoleError: typeof console.error;
16+
let _consoleWarn: typeof console.warn;
1617

1718
let SVG_CONTENTS = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none" stroke="#000" stroke-width="4" aria-label="Chicken"><path d="M48.1 34C22.1 32 1.4 51 2.5 67.2c1.2 16.1 19.8 17 29 17.8H89c15.7-6.6 6.3-18.9.3-20.5A28 28 0 0073 41.7c-.5-7.2 3.4-11.6 6.9-15.3 8.5 2.6 8-8 .8-7.2.6-6.5-12.3-5.9-6.7 2.7l-3.7 5c-6.9 5.4-10.9 5.1-22.2 7zM48.1 34c-38 31.9 29.8 58.4 25 7.7M70.3 26.9l5.4 4.2"/></svg>`;
1819

1920
test.beforeAll(async () => {
2021
_consoleError = console.error;
2122
console.error = () => {};
23+
_consoleWarn = console.warn;
24+
console.warn = () => {};
2225
fixture = await createFixture({
2326
files: {
2427
"app/routes/_index.tsx": js`
@@ -131,6 +134,7 @@ test.describe("loader in an app", async () => {
131134
test.afterAll(() => {
132135
appFixture.close();
133136
console.error = _consoleError;
137+
console.warn = _consoleWarn;
134138
});
135139

136140
test.describe("with JavaScript", () => {

integration/vite-prerender-test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,20 @@ function listAllFiles(_dir: string) {
150150
test.describe("Prerendering", () => {
151151
let fixture: Fixture;
152152
let appFixture: AppFixture;
153+
let _consoleError: typeof console.error;
154+
let _consoleWarn: typeof console.warn;
155+
156+
test.beforeAll(() => {
157+
_consoleError = console.error;
158+
console.error = () => {};
159+
_consoleWarn = console.warn;
160+
console.warn = () => {};
161+
});
153162

154163
test.afterAll(() => {
155164
appFixture.close();
165+
console.error = _consoleError;
166+
console.warn = _consoleWarn;
156167
});
157168

158169
test("Prerenders known static routes when true is specified", async () => {

0 commit comments

Comments
 (0)