diff --git a/.gitignore b/.gitignore index 0b6f98465..d3b50445e 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,5 @@ extensions/*-extension/bin/vulkaninfo # Turborepo .turbo +electron/test-data +electron/test-results diff --git a/core/src/node/helper/config.ts b/core/src/node/helper/config.ts index 1a341a625..0d14280cc 100644 --- a/core/src/node/helper/config.ts +++ b/core/src/node/helper/config.ts @@ -1,5 +1,5 @@ import { AppConfiguration, SettingComponentProps } from '../../types' -import { join } from 'path' +import { join, resolve } from 'path' import fs from 'fs' import os from 'os' import childProcess from 'child_process' @@ -10,7 +10,10 @@ const configurationFileName = 'settings.json' // TODO: do not default the os.homedir const defaultJanDataFolder = join(os?.homedir() || '', 'jan') const defaultAppConfig: AppConfiguration = { - data_folder: defaultJanDataFolder, + data_folder: + process.env.CI === 'e2e' + ? process.env.APP_CONFIG_PATH ?? resolve('./test-data') + : defaultJanDataFolder, quick_ask: false, } @@ -20,6 +23,7 @@ const defaultAppConfig: AppConfiguration = { * @returns {AppConfiguration} The app configurations. */ export const getAppConfigurations = (): AppConfiguration => { + if (process.env.CI === 'e2e') return defaultAppConfig // Retrieve Application Support folder path // Fallback to user home directory if not found const configurationFile = getConfigurationFilePath() diff --git a/core/src/node/helper/path.ts b/core/src/node/helper/path.ts index d488fbba6..8115383bb 100644 --- a/core/src/node/helper/path.ts +++ b/core/src/node/helper/path.ts @@ -11,6 +11,10 @@ export function normalizeFilePath(path: string): string { return path.replace(/^(file:[\\/]+)([^:\s]+)$/, '$2') } +/** + * App resources path + * Returns string - The current application directory. + */ export function appResourcePath() { try { const electron = require('electron')