Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Revert "Prevent false test failures caused by promise rejections hand…
…led asynchronously (#14110)"

This reverts commit 57e1d4e.
  • Loading branch information
SimenB committed Jul 6, 2023
commit aabae5724171b2d95ce4fa9507e792b7ceecd154
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

### Fixes

- `[jest-circus]` Prevent false test failures caused by promise rejections handled asynchronously ([#14110](https://github.com/jestjs/jest/pull/14110))
- `[jest-config]` Handle frozen config object ([#14054](https://github.com/facebook/jest/pull/14054))
- `[jest-config]` Allow `coverageDirectory` and `collectCoverageFrom` in project config ([#14180](https://github.com/jestjs/jest/pull/14180))
- `[jest-core]` Always use workers in watch mode to avoid crashes ([#14059](https://github.com/facebook/jest/pull/14059)).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`prints useful error for environment methods after test is done 1`] = `
" ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code.
"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.

9 | test('access environment methods after done', () => {
10 | setTimeout(() => {
Expand Down

This file was deleted.

236 changes: 0 additions & 236 deletions e2e/__tests__/__snapshots__/promiseAsyncHandling.test.ts.snap

This file was deleted.

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

exports[`prints useful error for requires after test is done 1`] = `
" ReferenceError: You are trying to \`import\` a file outside of the scope of the test code.
"ReferenceError: You are trying to \`import\` a file after the Jest environment has been torn down. From __tests__/lateRequire.test.js.

9 | test('require after done', () => {
10 | setTimeout(() => {
Expand Down

This file was deleted.

9 changes: 3 additions & 6 deletions e2e/__tests__/environmentAfterTeardown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/

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

skipSuiteOnJasmine();

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

expect(interestingLines).toMatchSnapshot();
expect(stderr.split('\n')[5]).toMatch(
'ReferenceError: You are trying to access a property or method of the Jest environment outside of the scope of the test code.',
expect(stderr.split('\n')[9]).toBe(
'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.',
);
});
21 changes: 0 additions & 21 deletions e2e/__tests__/environmentAfterTeardownJasmine.test.ts

This file was deleted.

6 changes: 1 addition & 5 deletions e2e/__tests__/fakeTimersLegacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

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

describe('enableGlobally', () => {
Expand Down Expand Up @@ -40,13 +39,10 @@ describe('requestAnimationFrame', () => {

describe('setImmediate', () => {
test('fakes setImmediate', () => {
// Jasmine runner does not handle unhandled promise rejections that are causing the test to fail in Jest circus
const expectedExitCode = isJestJasmineRun() ? 0 : 1;

const result = runJest('fake-timers-legacy/set-immediate');

expect(result.stderr).toMatch('setImmediate test');
expect(result.exitCode).toBe(expectedExitCode);
expect(result.exitCode).toBe(0);
});
});

Expand Down
Loading