Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Remove Jest auto mocking #2279

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@
"npm": "2.x || 3.x || 5.x || 6.x"
},
"jest": {
"automock": true,
"globals": {
"__DEV__": true
},
Expand Down
2 changes: 0 additions & 2 deletions src/component/base/__tests__/DraftEditor.react-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const DraftEditor = require('DraftEditor.react');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'use strict';

jest
.disableAutomock()
.mock('Style')
.mock('getElementPosition')
.mock('getScrollPosition')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const Editor = require('DraftEditor.react');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

'use strict';

jest.disableAutomock().mock('UserAgent');
jest.mock('UserAgent');

const BLOCK_DELIMITER_CHAR = '\n';
const TEST_A = 'Hello';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'use strict';

jest
.disableAutomock()
.mock('Style')
.mock('getElementPosition')
.mock('getScrollPosition')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

const ContentBlockNode = require('ContentBlockNode');
const ContentState = require('ContentState');
const DefaultDraftBlockRenderMap = require('DefaultDraftBlockRenderMap');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

// DraftEditorComposition uses timers to detect duplicate `compositionend`
// events.
jest.useFakeTimers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

import type DraftEditor from 'DraftEditor.react';

const CompositeDraftDecorator = require('CompositeDraftDecorator');
Expand Down
2 changes: 0 additions & 2 deletions src/component/handlers/edit/__tests__/editOnBlur-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const ContentBlock = require('ContentBlock');
const ContentState = require('ContentState');
const EditorState = require('EditorState');
Expand Down
2 changes: 0 additions & 2 deletions src/component/handlers/edit/__tests__/editOnInput-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const ContentBlock = require('ContentBlock');
const ContentState = require('ContentState');
const EditorState = require('EditorState');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const toggleExperimentalTreeDataSupport = enabled => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const toggleExperimentalTreeDataSupport = enabled => {
Expand Down
2 changes: 0 additions & 2 deletions src/component/selection/__tests__/DraftOffsetKey-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* @flow strict-local
*/

jest.disableAutomock();

const DraftOffsetKey = require('DraftOffsetKey');

test('decodes offset key with no delimiter', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

const getDraftEditorSelection = require('getDraftEditorSelection');
const getSampleSelectionMocksForTesting = require('getSampleSelectionMocksForTesting');
const getSampleSelectionMocksForTestingNestedBlocks = require('getSampleSelectionMocksForTestingNestedBlocks');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

jest.mock('ReactDOM');

const getContentEditableContainer = require('getContentEditableContainer');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const DraftTreeAdapter = require('DraftTreeAdapter');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

// missing parent -> child connection

const ContentBlockNode = require('ContentBlockNode');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @format
*/

jest.disableAutomock().mock('ContentState');
jest.mock('ContentState');

const CompositeDraftDecorator = require('CompositeDraftDecorator');
const ContentState = require('ContentState');
Expand Down
2 changes: 0 additions & 2 deletions src/model/encoding/__tests__/DraftStringKey-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const {stringify, unstringify} = require('DraftStringKey');

test('must convert maybe strings to a string key', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const BlockMapBuilder = require('BlockMapBuilder');
const CharacterMetadata = require('CharacterMetadata');
const ContentBlock = require('ContentBlock');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

'use strict';

jest.disableAutomock();
expect.addSnapshotSerializer(require('NonASCIIStringSnapshotSerializer'));

jest.mock('generateRandomKey');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const convertFromRawToDraftState = require('convertFromRawToDraftState');
Expand Down
2 changes: 0 additions & 2 deletions src/model/encoding/__tests__/decodeEntityRanges-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const decodeEntityRanges = require('decodeEntityRanges');

test('must decode when no entities present', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/model/encoding/__tests__/decodeInlineStyleRanges-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const decodeInlineStyleRanges = require('decodeInlineStyleRanges');

test('must decode for an unstyled block', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/model/encoding/__tests__/encodeEntityRanges-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const ContentBlock = require('ContentBlock');

const createCharacterList = require('createCharacterList');
Expand Down
2 changes: 0 additions & 2 deletions src/model/encoding/__tests__/encodeInlineStyleRanges-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const ContentBlock = require('ContentBlock');
const SampleDraftInlineStyle = require('SampleDraftInlineStyle');

Expand Down
2 changes: 0 additions & 2 deletions src/model/encoding/__tests__/sanitizeDraftText-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* @format
*/

jest.disableAutomock();

const sanitizeDraftText = require('sanitizeDraftText');

test('must strip trailing carriage returns', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/model/entity/__tests__/DraftEntity-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const DraftEntity = require('DraftEntity');

beforeEach(() => {
Expand Down
2 changes: 0 additions & 2 deletions src/model/entity/__tests__/getEntityKeyForSelection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
* @format
*/

jest.disableAutomock();

const getEntityKeyForSelection = require('getEntityKeyForSelection');
const getSampleStateForTesting = require('getSampleStateForTesting');

Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/BlockTree-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

const BlockTree = require('BlockTree');
const CharacterMetadata = require('CharacterMetadata');
const ContentBlock = require('ContentBlock');
Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/CharacterMetadata-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const CharacterMetadata = require('CharacterMetadata');
const {BOLD, BOLD_ITALIC, NONE, UNDERLINE} = require('SampleDraftInlineStyle');

Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/ContentBlock-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const CharacterMetadata = require('CharacterMetadata');
const ContentBlock = require('ContentBlock');
const {BOLD} = require('SampleDraftInlineStyle');
Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/ContentBlockNode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const CharacterMetadata = require('CharacterMetadata');
const ContentBlockNode = require('ContentBlockNode');
const {BOLD, NONE} = require('SampleDraftInlineStyle');
Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/ContentState-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

jest.mock('SelectionState');

let contentState;
Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/EditorBidiService-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const ContentBlock = require('ContentBlock');
const ContentState = require('ContentState');
const EditorBidiService = require('EditorBidiService');
Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/EditorState-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

const CharacterMetadata = require('CharacterMetadata');
const ContentBlock = require('ContentBlock');
const ContentState = require('ContentState');
Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/SelectionState-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const SelectionState = require('SelectionState');

const DEFAULT_CONFIG = {
Expand Down
2 changes: 0 additions & 2 deletions src/model/immutable/__tests__/findRangesImmutable-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

const findRangesImmutable = require('findRangesImmutable');
const Immutable = require('immutable');

Expand Down
2 changes: 0 additions & 2 deletions src/model/modifier/__tests__/AtomicBlockUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const AtomicBlockUtils = require('AtomicBlockUtils');
Expand Down
1 change: 0 additions & 1 deletion src/model/modifier/__tests__/DraftRemovableWord-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

'use strict';

jest.disableAutomock();
expect.addSnapshotSerializer(require('NonASCIIStringSnapshotSerializer'));

const DraftRemovableWord = require('DraftRemovableWord');
Expand Down
2 changes: 0 additions & 2 deletions src/model/modifier/__tests__/RichTextEditorUtil-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

jest.disableAutomock();

const AtomicBlockUtils = require('AtomicBlockUtils');
const DraftModifier = require('DraftModifier');
const EditorState = require('EditorState');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const ContentBlockNode = require('ContentBlockNode');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

jest.disableAutomock();

jest.mock('generateRandomKey');

const AtomicBlockUtils = require('AtomicBlockUtils');
Expand Down
2 changes: 0 additions & 2 deletions src/model/paste/__tests__/DraftPasteProcessor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

'use strict';

jest.disableAutomock();

jest.mock('generateRandomKey');

const DraftPasteProcessor = require('DraftPasteProcessor');
Expand Down