Fix sql formatter crash

This commit is contained in:
Chocobozzz 2024-10-31 10:49:24 +01:00
parent a91bd80087
commit 29cdeb0621
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 9 additions and 1 deletions

View File

@ -262,6 +262,14 @@ describe('Test logs', function () {
}) })
}) })
describe('With some log options', function () {
it('Should not crash when enabling `prettify_sql` config', async function () {
await server.kill()
await server.run({ log: { prettify_sql: true } })
})
})
after(async function () { after(async function () {
await cleanupTests([ server ]) await cleanupTests([ server ])
}) })

View File

@ -19,7 +19,7 @@ const consoleLoggerFormat = format.printf(info => {
if (info.sql) { if (info.sql) {
if (CONFIG.LOG.PRETTIFY_SQL) { if (CONFIG.LOG.PRETTIFY_SQL) {
additionalInfos += '\n' + sqlFormat(info.sql, { additionalInfos += '\n' + sqlFormat(info.sql, {
language: 'sql', language: 'postgresql',
tabWidth: 2 tabWidth: 2
}) })
} else { } else {