Chore: Fix running frontend unit tests in JetBrains (#93441)

read the files with their absolute paths
This commit is contained in:
ismail simsek 2024-09-18 17:51:58 +02:00 committed by GitHub
parent 6a3dbe7d41
commit 37e4353a18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,13 +1,15 @@
const { parse } = require('ini'); const { parse } = require('ini');
const { readFileSync, existsSync } = require('node:fs'); const { readFileSync, existsSync } = require('node:fs');
const path = require('path');
const getEnvConfig = () => { const getEnvConfig = () => {
const defaultSettings = readFileSync(`./conf/defaults.ini`, { const grafanaRoot = path.join(__dirname, '../..');
const defaultSettings = readFileSync(`${grafanaRoot}/conf/defaults.ini`, {
encoding: 'utf-8', encoding: 'utf-8',
}); });
const customSettings = existsSync(`./conf/custom.ini`) const customSettings = existsSync(`${grafanaRoot}/conf/custom.ini`)
? readFileSync(`./conf/custom.ini`, { ? readFileSync(`${grafanaRoot}/conf/custom.ini`, {
encoding: 'utf-8', encoding: 'utf-8',
}) })
: ''; : '';