mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00

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.
25 lines
951 B
TypeScript
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(''));
|
|
}
|