From 18cac0321b099e4bbf37088a705ad72a4b25d2ae Mon Sep 17 00:00:00 2001 From: Maximilian Link Date: Thu, 24 Jul 2025 11:08:48 +0200 Subject: [PATCH 1/2] add persist option for debugtopus --- jest.config.ts | 2 +- src/cli.ts | 4 ++++ src/debugtopus/index.ts | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/jest.config.ts b/jest.config.ts index 7626f24..31727db 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -5,7 +5,7 @@ const jestConfig: jest.Config = { testMatch: ["**/tests/**/*.spec.ts"], testPathIgnorePatterns: ["dist", "node_modules"], testTimeout: 20_000, - watchPathIgnorePatterns: ["temp"], + watchPathIgnorePatterns: ["octomind-cli-debug"], prettierPath: null, //https://github.com/jestjs/jest/issues/14305 -> jest 30 will support it }; diff --git a/src/cli.ts b/src/cli.ts index 1aa5716..30a1e3c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -119,6 +119,10 @@ export const buildCmd = (): Command => { "--headless", "if we should run headless without the UI of playwright and the browser", ) + .option( + "--persist", + "if we should write playwright config and files to current directory, you can then run 'npx playwright test' to run them again", + ) .action((_, options) => runDebugtopus({ ...options, diff --git a/src/debugtopus/index.ts b/src/debugtopus/index.ts index a50603f..d66c7cb 100644 --- a/src/debugtopus/index.ts +++ b/src/debugtopus/index.ts @@ -18,6 +18,7 @@ type DebugtopusOptions = { url: string; environmentId?: string; headless?: boolean; + persist?: boolean; }; const getPackageRootLevel = (appDir: string): string => { @@ -72,7 +73,7 @@ const prepareDirectories = async ( packageRootDir = getPackageRootLevel(appDir); } - const tempDir = path.join(packageRootDir, "temp"); + const tempDir = path.join(packageRootDir, "octomind-cli-debug"); if (existsSync(tempDir)) { await fs.rm(tempDir, { force: true, recursive: true }); @@ -208,7 +209,9 @@ export const runDebugtopus = async (options: DebugtopusOptions) => { throw new Error("no environment found"); } - const dirs = await prepareDirectories(); + const dirs = await prepareDirectories( + options.persist ? process.cwd() : undefined, + ); const config = await getPlaywrightConfig({ testTargetId: options.testTargetId, From 9e141dd54269d6c97bb0f8e895f7cf6ae76aee94 Mon Sep 17 00:00:00 2001 From: Maximilian Link Date: Thu, 24 Jul 2025 13:44:06 +0200 Subject: [PATCH 2/2] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 234c552..e0d6d38 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ src/version.ts node_modules/ .idea octomind.config.json +octomind-cli-debug/