mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-19 20:47:46 +00:00
* ci: init e2e test for browser env stash changes * test: update fsentry definition, add tests stash changes * test: pass puter-js mkdir test * test: add test for puter-js move * tidy code * tidy code * doc: add docs for playwright test * recover memoryfs * test: puter-js readdir/stat * test: puter-js write * test: puter-js read * test: puter-js move_cart * test: fix failed tests on move * tests: rename files * test: puter-js copy_cart * tests: puter-js batch/delete, read config from file * ci: add vitest * ci: update names and timeout * ci: simplify playwright-test * ci: simplify api-test * move "api-tester" from tools to tests * test: update example config * test: remove folder tests/api-tester/ci * test: unify config location * test: remove unused files * ci: fix wrong config * ci: fix wrong path * test: add docs * ci: update timeout, print artifact url
33 lines
978 B
TypeScript
33 lines
978 B
TypeScript
import * as fs from 'fs'
|
|
import * as path from 'path'
|
|
import * as yaml from 'yaml'
|
|
|
|
// Strong-typed configuration interface
|
|
export interface TestConfig {
|
|
api_url: string
|
|
frontend_url: string
|
|
username: string
|
|
auth_token: string
|
|
}
|
|
|
|
// Singleton configuration loader - loads config only once
|
|
let config: TestConfig | null = null
|
|
|
|
export function getTestConfig(): TestConfig {
|
|
if (config === null) {
|
|
const configPath = path.join(__dirname, '../../client-config.yaml')
|
|
const rawConfig = yaml.parse(fs.readFileSync(configPath, 'utf8'))
|
|
|
|
// Validate required fields
|
|
if (!rawConfig.api_url || !rawConfig.frontend_url || !rawConfig.username || !rawConfig.auth_token) {
|
|
throw new Error('Invalid test configuration: missing required fields')
|
|
}
|
|
|
|
config = rawConfig as TestConfig
|
|
}
|
|
return config
|
|
}
|
|
|
|
// Export the typed configuration
|
|
export const testConfig: TestConfig = getTestConfig()
|