mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Chore: Disable Jest console wrapper in tests
This commit is contained in:
parent
d2fe33183b
commit
e47ac1de6a
16
jest.base-setup.js
Normal file
16
jest.base-setup.js
Normal file
@ -0,0 +1,16 @@
|
||||
/* eslint-disable jest/require-top-level-describe */
|
||||
|
||||
module.exports = () => {
|
||||
// Disable the additional information that Jest adds to each console
|
||||
// statement. It's rarely needed and if it is it can be commented out here.
|
||||
|
||||
const jestConsole = console;
|
||||
|
||||
beforeEach(() => {
|
||||
global.console = require('console');
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
global.console = jestConsole;
|
||||
});
|
||||
};
|
@ -3,6 +3,7 @@ const { shimInit } = require('@joplin/lib/shim-init-node.js');
|
||||
const shim = require('@joplin/lib/shim').default;
|
||||
const sharp = require('sharp');
|
||||
const nodeSqlite = require('sqlite3');
|
||||
require('../../jest.base-setup.js')();
|
||||
|
||||
let keytar;
|
||||
try {
|
||||
|
@ -3,6 +3,7 @@
|
||||
const { shimInit } = require('@joplin/lib/shim-init-node');
|
||||
const sqlite3 = require('sqlite3');
|
||||
const SyncTargetNone = require('@joplin/lib/SyncTargetNone').default;
|
||||
require('../../jest.base-setup.js')();
|
||||
|
||||
// Mock the S3 sync target -- the @aws-s3 libraries depend on an old version
|
||||
// of uuid that doesn't work with jest without additional configuration.
|
||||
|
@ -7,6 +7,7 @@ const path = require('path');
|
||||
const { tmpdir } = require('os');
|
||||
const uuid = require('@joplin/lib/uuid').default;
|
||||
const sqlite3 = require('sqlite3');
|
||||
require('../../jest.base-setup.js')();
|
||||
|
||||
import { setImmediate } from 'timers';
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
require('../../jest.base-setup.js')();
|
||||
|
||||
// Prevents the CodeMirror error "getClientRects is undefined".
|
||||
// See https://github.com/jsdom/jsdom/issues/3002#issue-652790925
|
||||
|
@ -4,6 +4,8 @@ const sharp = require('sharp');
|
||||
const nodeSqlite = require('sqlite3');
|
||||
const pdfJs = require('pdfjs-dist');
|
||||
|
||||
require('../../jest.base-setup.js')();
|
||||
|
||||
shimInit({ sharp, nodeSqlite, pdfJs });
|
||||
|
||||
global.afterEach(async () => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
const { shimInit } = require('@joplin/lib/shim-init-node.js');
|
||||
const nodeSqlite = require('sqlite3');
|
||||
require('../../jest.base-setup.js')();
|
||||
|
||||
shimInit({ nodeSqlite });
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user