mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Chore: Mobile: Tests: Fix CodeMirror-related error messages (#8569)
This commit is contained in:
parent
46ccd94514
commit
f76ae86204
@ -1,7 +1,3 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { EditorSelection } from '@codemirror/state';
|
||||
import { ListType } from '../types';
|
||||
import createEditor from './testUtil/createEditor';
|
||||
|
@ -1,7 +1,3 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { EditorSelection } from '@codemirror/state';
|
||||
import {
|
||||
toggleBolded, toggleCode, toggleHeaderLevel, toggleItalicized, toggleMath, updateLink,
|
||||
|
@ -1,7 +1,3 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
|
||||
import { EditorSelection, EditorState } from '@codemirror/state';
|
||||
import {
|
||||
increaseIndent, toggleList,
|
||||
|
@ -1,6 +1,3 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
import { syntaxTree } from '@codemirror/language';
|
||||
import { SyntaxNode } from '@lezer/common';
|
||||
import { EditorSelection, EditorState } from '@codemirror/state';
|
||||
|
@ -1,12 +1,4 @@
|
||||
/**
|
||||
* @jest-environment jsdom
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { setImmediate } from 'timers';
|
||||
|
||||
// Required by some libraries (setImmediate is not supported in most browsers,
|
||||
// so is removed by jsdom).
|
||||
window.setImmediate = setImmediate;
|
||||
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import { act, fireEvent, render, waitFor } from '@testing-library/react-native';
|
||||
|
@ -12,6 +12,7 @@ module.exports = {
|
||||
'\\.(ts|tsx)$': 'ts-jest',
|
||||
},
|
||||
|
||||
testEnvironment: 'jsdom',
|
||||
testMatch: ['**/*.test.(ts|tsx)'],
|
||||
|
||||
testPathIgnorePatterns: ['<rootDir>/node_modules/'],
|
||||
|
@ -8,6 +8,29 @@ const { tmpdir } = require('os');
|
||||
const uuid = require('@joplin/lib/uuid').default;
|
||||
const sqlite3 = require('sqlite3');
|
||||
|
||||
import { setImmediate } from 'timers';
|
||||
|
||||
// Required by some libraries (setImmediate is not supported in most browsers,
|
||||
// so is removed by jsdom).
|
||||
window.setImmediate = setImmediate;
|
||||
|
||||
// Prevents the CodeMirror error "getClientRects is undefined".
|
||||
// See https://github.com/jsdom/jsdom/issues/3002#issue-652790925
|
||||
document.createRange = () => {
|
||||
const range = new Range();
|
||||
range.getBoundingClientRect = jest.fn();
|
||||
range.getClientRects = () => {
|
||||
return {
|
||||
length: 0,
|
||||
item: () => null,
|
||||
[Symbol.iterator]: jest.fn(),
|
||||
};
|
||||
};
|
||||
|
||||
return range;
|
||||
};
|
||||
|
||||
|
||||
shimInit({ nodeSqlite: sqlite3 });
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user