Files
windmill/cli/test/test_config_helpers.ts
Alexander Petric aa37f643e7 feat: git sync improvements (#6182)
* init checkpoint

* ui second pass...

* round 1 backend + saving settings + detecting changes...

* checkpoint

* fix openapi

* saving + correct wmill.yaml diff

* cli refactor

* cli and tests refactor done

* cli multi workspace support

* cli support skip core types to align with ui

* new test framework

* sqlx

* openapi spec

* frontend

* sync + settings changes

* some fixes

* some fixes

* security: Remove hardcoded EE license key, use environment variable only

- Remove hardcoded license key from containerized test backend
- Environment variable EE_LICENSE_KEY now required for EE features
- License key no longer stored in database during tests

* sqlx

* tests

* fixing tests

* fix tests

* checkpoint

* checkpoint

* cli build

* frontend - cli exchange

* settings match

* ee repo ref

* npm check

* openapi

* tests

* checkpoint

* cli + tests

* reset to preview on changes

* merge issue ee

* cleanup

* hubscript

* simplifications

* ee repo ref

* cli fixes

* fix sync and add tests

* extra test

* git sync settings / key change aware

* ee-repo ref

* ee-repo ref

* ee repo ref

* ee ref

* review 1

* ee ref

* Update frontend/src/lib/components/PullGitRepoPopover.svelte

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Update frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* ee ref

* remove extra includes from ui

---------

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-07-15 16:25:31 +00:00

39 lines
1.2 KiB
TypeScript

import { getRootStore } from "../store.ts";
/**
* Create a temporary config directory for testing that doesn't interfere with user's config
*/
export async function withTestConfig<T>(callback: (testConfigDir: string) => Promise<T>): Promise<T> {
// Create a unique temporary directory for this test
const testDir = await Deno.makeTempDir({ prefix: "wmill_test_config_" });
try {
return await callback(testDir);
} finally {
// Clean up the temporary directory
try {
await Deno.remove(testDir, { recursive: true });
} catch (error) {
console.warn(`Failed to clean up test config directory ${testDir}:`, error);
}
}
}
/**
* Clear the remotes file in test config directory
*/
export async function clearTestRemotes(testConfigDir: string): Promise<void> {
const remoteFile = (await getRootStore(testConfigDir)) + "remotes.ndjson";
await Deno.writeTextFile(remoteFile, "");
}
/**
* Parse JSON output from CLI command, handling log messages that appear before JSON
*/
export function parseJsonFromCLIOutput(stdout: string): any {
const jsonMatch = stdout.match(/\{[\s\S]*\}/);
if (!jsonMatch) {
throw new Error(`No JSON found in CLI output: ${stdout}`);
}
return JSON.parse(jsonMatch[0]);
}