From 49044c80c8dacb07e0356ea4ab896b7d7ff7c4c7 Mon Sep 17 00:00:00 2001 From: Ferran Diaz Date: Mon, 2 Feb 2026 19:29:42 +0100 Subject: [PATCH 1/5] feat: add --install-command flag to pw-test --- packages/cli/src/commands/pw-test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/cli/src/commands/pw-test.ts b/packages/cli/src/commands/pw-test.ts index 1d3aec4ad..1d192081c 100644 --- a/packages/cli/src/commands/pw-test.ts +++ b/packages/cli/src/commands/pw-test.ts @@ -100,6 +100,9 @@ export default class PwTestCommand extends AuthCommand { multiple: true, default: [], }), + 'install-command': Flags.string({ + description: 'Command to install dependencies before running tests.', + }), } async run (): Promise { @@ -122,6 +125,7 @@ export default class PwTestCommand extends AuthCommand { 'create-check': createCheck, 'stream-logs': streamLogs, 'include': includeFlag, + 'install-command': installCommand, } = flags const { configDirectory, configFilenames } = splitConfigFilePath(configFilename) const pwPathFlag = this.getConfigPath(playwrightFlags) @@ -148,6 +152,7 @@ export default class PwTestCommand extends AuthCommand { runLocation as keyof Region, privateRunLocation, dir, + installCommand, ) if (createCheck) { this.style.actionStart('Adding check with specified options to the Checkly config file') @@ -335,6 +340,7 @@ export default class PwTestCommand extends AuthCommand { runLocation: keyof Region, privateRunLocation: string | undefined, dir: string, + installCommand?: string, ): Promise { const parseArgs = args.map(arg => shellQuote(arg)) const input = parseArgs.join(' ') || '' @@ -352,6 +358,7 @@ export default class PwTestCommand extends AuthCommand { testCommand, ...locationConfig, frequency: 10, + ...(installCommand ? { installCommand } : {}), } } From eb8b5e49ada8a2c87233c269370691342dcfaac3 Mon Sep 17 00:00:00 2001 From: Ferran Diaz Date: Mon, 2 Feb 2026 19:30:08 +0100 Subject: [PATCH 2/5] feat: add tests for install-command flag --- packages/cli/e2e/__tests__/pw-test.spec.ts | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/packages/cli/e2e/__tests__/pw-test.spec.ts b/packages/cli/e2e/__tests__/pw-test.spec.ts index fb7abad20..9bcc40271 100644 --- a/packages/cli/e2e/__tests__/pw-test.spec.ts +++ b/packages/cli/e2e/__tests__/pw-test.spec.ts @@ -51,8 +51,28 @@ describe('pw-test', { timeout: 45000 }, () => { expect(checklyConfig.config?.checks).toBeDefined() expect(checklyConfig.config?.checks?.playwrightConfigPath).toBe('./playwright.config.ts') expect(checklyConfig.config?.checks?.playwrightChecks).toBeDefined() - expect(checklyConfig.config?.checks?.playwrightChecks.length).toBe(1) - expect(checklyConfig.config?.checks?.playwrightChecks[0].name).toBe('Playwright Test: --grep @TAG-B') - expect(checklyConfig.config?.checks?.playwrightChecks[0].testCommand).toBe('npx playwright test --grep @TAG-B') + const playwrightChecks = checklyConfig.config?.checks?.playwrightChecks + expect(playwrightChecks).toBeDefined() + expect(playwrightChecks!.length).toBe(1) + expect(playwrightChecks![0].name).toBe('Playwright Test: --grep @TAG-B') + expect(playwrightChecks![0].testCommand).toBe('npx playwright test --grep @TAG-B') + }) + + it('Should add a Playwright test with custom install command to the config', async () => { + const result = await runChecklyCli({ + args: ['pw-test', '--install-command', 'pnpm install', '--create-check', '--', `--grep`, '@TAG-B'], + apiKey: config.get('apiKey'), + accountId: config.get('accountId'), + directory: FIXTURE_TEST_PWT_NATIVE, + timeout: 120000, // 2 minutes + }) + expect(result.status).toBe(0) + const checklyConfig = await loadChecklyConfig(FIXTURE_TEST_PWT_NATIVE) + expect(checklyConfig.config?.checks).toBeDefined() + expect(checklyConfig.config?.checks?.playwrightChecks).toBeDefined() + const playwrightChecks = checklyConfig.config?.checks?.playwrightChecks + expect(playwrightChecks).toBeDefined() + expect(playwrightChecks!.length).toBe(1) + expect(playwrightChecks![0].installCommand).toBe('pnpm install') }) }) From 0203551e6453e44cacc410dbcbcdd7dcb3f2490b Mon Sep 17 00:00:00 2001 From: Ferran Diaz Date: Tue, 3 Feb 2026 10:26:11 +0100 Subject: [PATCH 3/5] fix: test --- packages/cli/e2e/__tests__/pw-test.spec.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/cli/e2e/__tests__/pw-test.spec.ts b/packages/cli/e2e/__tests__/pw-test.spec.ts index 9bcc40271..9f77d8bc3 100644 --- a/packages/cli/e2e/__tests__/pw-test.spec.ts +++ b/packages/cli/e2e/__tests__/pw-test.spec.ts @@ -60,19 +60,23 @@ describe('pw-test', { timeout: 45000 }, () => { it('Should add a Playwright test with custom install command to the config', async () => { const result = await runChecklyCli({ - args: ['pw-test', '--install-command', 'pnpm install', '--create-check', '--', `--grep`, '@TAG-B'], + args: ['pw-test', '--install-command', 'pnpm install', '--create-check', '--', `--grep`, '@TAG-A'], apiKey: config.get('apiKey'), accountId: config.get('accountId'), directory: FIXTURE_TEST_PWT_NATIVE, timeout: 120000, // 2 minutes }) + if (result.status !== 0) { + // eslint-disable-next-line no-console + console.log(result) + } expect(result.status).toBe(0) const checklyConfig = await loadChecklyConfig(FIXTURE_TEST_PWT_NATIVE) expect(checklyConfig.config?.checks).toBeDefined() expect(checklyConfig.config?.checks?.playwrightChecks).toBeDefined() const playwrightChecks = checklyConfig.config?.checks?.playwrightChecks expect(playwrightChecks).toBeDefined() - expect(playwrightChecks!.length).toBe(1) - expect(playwrightChecks![0].installCommand).toBe('pnpm install') + expect(playwrightChecks!.length).toBe(2) + expect(playwrightChecks![1].installCommand).toBe('pnpm install') }) }) From 01465d28a52cdb0ba9052a3082f3027e1c45c1ba Mon Sep 17 00:00:00 2001 From: Ferran Diaz Date: Wed, 4 Feb 2026 12:27:48 +0100 Subject: [PATCH 4/5] fix: tests --- packages/cli/e2e/__tests__/pw-test.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/e2e/__tests__/pw-test.spec.ts b/packages/cli/e2e/__tests__/pw-test.spec.ts index 9f77d8bc3..6977e3c22 100644 --- a/packages/cli/e2e/__tests__/pw-test.spec.ts +++ b/packages/cli/e2e/__tests__/pw-test.spec.ts @@ -76,7 +76,7 @@ describe('pw-test', { timeout: 45000 }, () => { expect(checklyConfig.config?.checks?.playwrightChecks).toBeDefined() const playwrightChecks = checklyConfig.config?.checks?.playwrightChecks expect(playwrightChecks).toBeDefined() - expect(playwrightChecks!.length).toBe(2) - expect(playwrightChecks![1].installCommand).toBe('pnpm install') + expect(playwrightChecks!.length).toBe(1) + expect(playwrightChecks![0].installCommand).toBe('pnpm install') }) }) From f515ebc63e62d4ac5de1b7d85601caade8d1115f Mon Sep 17 00:00:00 2001 From: Ferran Diaz Date: Mon, 9 Feb 2026 16:38:07 +0000 Subject: [PATCH 5/5] fix: test --- packages/cli/e2e/__tests__/pw-test.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/e2e/__tests__/pw-test.spec.ts b/packages/cli/e2e/__tests__/pw-test.spec.ts index 8c23816e7..d70b34e54 100644 --- a/packages/cli/e2e/__tests__/pw-test.spec.ts +++ b/packages/cli/e2e/__tests__/pw-test.spec.ts @@ -88,6 +88,8 @@ describe('pw-test', { timeout: 45000 }, () => { // eslint-disable-next-line no-console console.log(result) } + const configContent = fs.readFileSync( + path.join(FIXTURE_TEST_PWT_NATIVE, 'checkly.config.ts'), 'utf-8') expect(result.status).toBe(0) const checklyConfig = await loadChecklyConfig(FIXTURE_TEST_PWT_NATIVE) expect(checklyConfig.config?.checks).toBeDefined() @@ -95,6 +97,6 @@ describe('pw-test', { timeout: 45000 }, () => { const playwrightChecks = checklyConfig.config?.checks?.playwrightChecks expect(playwrightChecks).toBeDefined() expect(playwrightChecks!.length).toBe(1) - expect(playwrightChecks![0].installCommand).toBe('pnpm install') + expect(configContent).toContain('pnpm install') }) })