Joachim Van Herwegen 6248ed0938 refactor: Replace linting configurations
The previous package was outdated, preventing us from updating TS.
This one also lints YAML and JSON,
and applies many more rules to the test files,
explaining all the changes in this PR.
2023-11-02 09:49:17 +01:00

25 lines
951 B
TypeScript

import { setGlobalLoggerFactory } from '../../src/logging/LogUtil';
import { WinstonLoggerFactory } from '../../src/logging/WinstonLoggerFactory';
import { getTestFolder, removeFolder } from '../integration/Config';
// Jest global setup requires a single function to be exported
export default async function(): Promise<void> {
// Set the main logger
const level = process.env.LOGLEVEL ?? 'off';
const loggerFactory = new WinstonLoggerFactory(level);
setGlobalLoggerFactory(loggerFactory);
// Also set the logger factory of transpiled JS modules
// (which are instantiated by Components.js)
try {
// eslint-disable-next-line ts/no-var-requires,ts/no-require-imports
const dist = require('../../dist/logging/LogUtil');
dist.setGlobalLoggerFactory(loggerFactory);
} catch {
// Ignore
}
// Clean up the test folder to prevent issues with remaining files from previous tests
await removeFolder(getTestFolder(''));
}