dbgate/integration-tests/setupTests.js

31 lines
690 B
JavaScript
Raw Permalink Normal View History

2024-09-16 16:50:14 +00:00
global.DBGATE_PACKAGES = {
'dbgate-tools': require('dbgate-tools'),
'dbgate-sqltree': require('dbgate-sqltree'),
};
2024-09-12 06:24:50 +00:00
const { prettyFactory } = require('pino-pretty');
2024-09-16 16:50:14 +00:00
const tmp = require('tmp');
2024-09-12 06:24:50 +00:00
const pretty = prettyFactory({
colorize: true,
translateTime: 'SYS:standard',
ignore: 'pid,hostname',
});
global.console = {
...console,
log: (...messages) => {
try {
const parsedMessage = JSON.parse(messages[0]);
2024-09-12 06:43:34 +00:00
process.stdout.write(pretty(parsedMessage));
2024-09-12 06:24:50 +00:00
} catch (error) {
process.stdout.write(messages.join(' ') + '\n');
}
},
debug: (...messages) => {
process.stdout.write(messages.join(' ') + '\n');
},
};
2024-09-16 16:50:14 +00:00
tmp.setGracefulCleanup();