Skip to content

Commit 208f2f1

Browse files
authored
Revert "Prevent false test failures caused by promise rejections handled asynchronously (#14110)" (#14304)
1 parent 596422e commit 208f2f1

28 files changed

+21
-770
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Fixes
66

7+
- `[jest-circus]` Revert [#14110](https://github.com/jestjs/jest/pull/14110) as it was a breaking change
8+
79
### Chore & Maintenance
810

911
### Performance

e2e/__tests__/__snapshots__/environmentAfterTeardown.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`prints useful error for environment methods after test is done 1`] = `
4-
" ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code.
4+
"ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js.
55
66
9 | test('access environment methods after done', () => {
77
10 | setTimeout(() => {

e2e/__tests__/__snapshots__/environmentAfterTeardownJasmine.test.ts.snap

-13
This file was deleted.

e2e/__tests__/__snapshots__/promiseAsyncHandling.test.ts.snap

-236
This file was deleted.

e2e/__tests__/__snapshots__/requireAfterTeardown.test.ts.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`prints useful error for requires after test is done 1`] = `
4-
" ReferenceError: You are trying to \`import\` a file outside of the scope of the test code.
4+
"ReferenceError: You are trying to \`import\` a file after the Jest environment has been torn down. From __tests__/lateRequire.test.js.
55
66
9 | test('require after done', () => {
77
10 | setTimeout(() => {

e2e/__tests__/__snapshots__/requireAfterTeardownJasmine.test.ts.snap

-13
This file was deleted.

e2e/__tests__/environmentAfterTeardown.test.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {skipSuiteOnJasmine} from '@jest/test-utils';
98
import runJest from '../runJest';
109

11-
skipSuiteOnJasmine();
12-
1310
test('prints useful error for environment methods after test is done', () => {
1411
const {stderr} = runJest('environment-after-teardown');
15-
const interestingLines = stderr.split('\n').slice(5, 14).join('\n');
12+
const interestingLines = stderr.split('\n').slice(9, 18).join('\n');
1613

1714
expect(interestingLines).toMatchSnapshot();
18-
expect(stderr.split('\n')[5]).toMatch(
19-
'ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code.',
15+
expect(stderr.split('\n')[9]).toBe(
16+
'ReferenceError: You are trying to access a property or method of the Jest environment after it has been torn down. From __tests__/afterTeardown.test.js.',
2017
);
2118
});

e2e/__tests__/environmentAfterTeardownJasmine.test.ts

-21
This file was deleted.

e2e/__tests__/fakeTimersLegacy.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import {isJestJasmineRun} from '@jest/test-utils';
98
import runJest from '../runJest';
109

1110
describe('enableGlobally', () => {
@@ -40,13 +39,10 @@ describe('requestAnimationFrame', () => {
4039

4140
describe('setImmediate', () => {
4241
test('fakes setImmediate', () => {
43-
// Jasmine runner does not handle unhandled promise rejections that are causing the test to fail in Jest circus
44-
const expectedExitCode = isJestJasmineRun() ? 0 : 1;
45-
4642
const result = runJest('fake-timers-legacy/set-immediate');
4743

4844
expect(result.stderr).toMatch('setImmediate test');
49-
expect(result.exitCode).toBe(expectedExitCode);
45+
expect(result.exitCode).toBe(0);
5046
});
5147
});
5248

0 commit comments

Comments
 (0)