diff --git a/e2e/__tests__/globalSetup.test.ts b/e2e/__tests__/globalSetup.test.ts index d691bf61c37f..04e08bd4fa0d 100644 --- a/e2e/__tests__/globalSetup.test.ts +++ b/e2e/__tests__/globalSetup.test.ts @@ -71,8 +71,9 @@ test('jest throws an error when globalSetup does not export a function', () => { ]); expect(exitCode).toBe(1); - expect(stderr).toMatch( - `TypeError: globalSetup file must export a function at ${setupPath}`, + expect(stderr).toContain('Jest: Got error running globalSetup'); + expect(stderr).toContain( + `globalSetup file must export a function at ${setupPath}`, ); }); @@ -154,8 +155,9 @@ test('globalSetup throws with named export', () => { ]); expect(exitCode).toBe(1); - expect(stderr).toMatch( - `TypeError: globalSetup file must export a function at ${setupPath}`, + expect(stderr).toContain('Jest: Got error running globalSetup'); + expect(stderr).toContain( + `globalSetup file must export a function at ${setupPath}`, ); }); diff --git a/e2e/__tests__/globalTeardown.test.ts b/e2e/__tests__/globalTeardown.test.ts index a3947ef1c337..200faff130f4 100644 --- a/e2e/__tests__/globalTeardown.test.ts +++ b/e2e/__tests__/globalTeardown.test.ts @@ -55,8 +55,9 @@ test('jest throws an error when globalTeardown does not export a function', () = ]); expect(exitCode).toBe(1); - expect(stderr).toMatch( - `TypeError: globalTeardown file must export a function at ${teardownPath}`, + expect(stderr).toContain('Jest: Got error running globalTeardown'); + expect(stderr).toContain( + `globalTeardown file must export a function at ${teardownPath}`, ); }); @@ -125,7 +126,8 @@ test('globalTeardown throws with named export', () => { ]); expect(exitCode).toBe(1); - expect(stderr).toMatch( - `TypeError: globalTeardown file must export a function at ${teardownPath}`, + expect(stderr).toContain('Jest: Got error running globalTeardown'); + expect(stderr).toContain( + `globalTeardown file must export a function at ${teardownPath}`, ); });