Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/cli/src/commands/pw-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ export default class PwTestCommand extends AuthCommand {
'install-command': Flags.string({
description: 'Command to install dependencies before running tests.',
}),
'refresh-cache': Flags.boolean({
description: 'Force a fresh install of dependencies and update the cached version.',
default: false,
}),
}

async run (): Promise<void> {
Expand All @@ -134,6 +138,7 @@ export default class PwTestCommand extends AuthCommand {
'include': includeFlag,
'frequency': frequency,
'install-command': installCommand,
'refresh-cache': refreshCache,
} = flags
const { configDirectory, configFilenames } = splitConfigFilePath(configFilename)
const pwPathFlag = this.getConfigPath(playwrightFlags)
Expand Down Expand Up @@ -315,6 +320,7 @@ export default class PwTestCommand extends AuthCommand {
// TODO: ADD PROPER RETRY STRATEGY HANDLING
null, // testRetryStrategy
streamLogs,
refreshCache,
)

runner.on(Events.RUN_STARTED,
Expand Down
9 changes: 8 additions & 1 deletion packages/cli/src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ export default class Test extends AuthCommand {
allowNo: true,
env: 'CHECKLY_VERIFY_RUNTIME_DEPENDENCIES',
}),
'refresh-cache': Flags.boolean({
description: 'Force a fresh install of dependencies and update the cached version.',
default: false,
}),
}

static args = {
Expand Down Expand Up @@ -144,6 +148,7 @@ export default class Test extends AuthCommand {
'update-snapshots': updateSnapshots,
retries,
'verify-runtime-dependencies': verifyRuntimeDependencies,
'refresh-cache': refreshCache,
} = flags
const filePatterns = argv as string[]

Expand Down Expand Up @@ -180,7 +185,7 @@ export default class Test extends AuthCommand {
availableRuntimes: availableRuntimes.reduce((acc, runtime) => {
acc[runtime.name] = runtime
return acc
}, <Record<string, Runtime>> {}),
}, <Record<string, Runtime>>{}),
defaultRuntimeId: account.runtimeId,
verifyRuntimeDependencies,
checklyConfigConstructs,
Expand Down Expand Up @@ -358,6 +363,8 @@ export default class Test extends AuthCommand {
updateSnapshots,
configDirectory,
testRetryStrategy,
undefined,
refreshCache,
)

runner.on(Events.RUN_STARTED,
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/src/commands/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export default class Trigger extends AuthCommand {
'retries': Flags.integer({
description: `[default: 0, max: ${MAX_RETRIES}] How many times to retry a check run.`,
}),
'refresh-cache': Flags.boolean({
description: 'Force a fresh install of dependencies and update the cached version.',
default: false,
}),
}

async run (): Promise<void> {
Expand All @@ -108,6 +112,7 @@ export default class Trigger extends AuthCommand {
'env-file': envFile,
'test-session-name': testSessionName,
retries,
'refresh-cache': refreshCache,
} = flags
const envVars = await getEnvs(envFile, env)
const { configDirectory, configFilenames } = splitConfigFilePath(configFilename)
Expand Down Expand Up @@ -143,6 +148,7 @@ export default class Trigger extends AuthCommand {
ciInfo.environment,
testSessionName,
testRetryStrategy,
refreshCache,
)
// TODO: This is essentially the same for `checkly test`. Maybe reuse code.
runner.on(Events.RUN_STARTED,
Expand Down
1 change: 0 additions & 1 deletion packages/cli/src/constructs/api-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { DeprecatedPropertyDiagnostic, InvalidPropertyValueDiagnostic } from './
import { ApiCheckBundle, ApiCheckBundleProps } from './api-check-bundle'
import { Assertion } from './api-assertion'
import { validateResponseTimes } from './internal/common-diagnostics'
import { Runtime } from '../runtimes'

/**
* Default configuration that can be applied to API checks.
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/rest/test-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type RunTestSessionRequest = {
environment?: string | null
shouldRecord: boolean
streamLogs?: boolean
refreshCache?: boolean
}

type TriggerTestSessionRequest = {
Expand All @@ -27,6 +28,7 @@ type TriggerTestSessionRequest = {
repoInfo: GitInformation | null
environment: string | null
testRetryStrategy: RetryStrategy | null
refreshCache?: boolean
}

export type TestResultsShortLinks = {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/services/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class TestRunner extends AbstractCheckRunner {
baseDirectory: string
testRetryStrategy: RetryStrategy | null
streamLogs: boolean
refreshCache: boolean

constructor (
accountId: string,
Expand All @@ -37,6 +38,7 @@ export default class TestRunner extends AbstractCheckRunner {
baseDirectory: string,
testRetryStrategy: RetryStrategy | null,
streamLogs?: boolean,
refreshCache?: boolean,
) {
super(accountId, timeout, verbose)
this.projectBundle = projectBundle
Expand All @@ -50,6 +52,7 @@ export default class TestRunner extends AbstractCheckRunner {
this.baseDirectory = baseDirectory
this.testRetryStrategy = testRetryStrategy
this.streamLogs = streamLogs ?? false
this.refreshCache = refreshCache ?? false
}

async scheduleChecks (
Expand Down Expand Up @@ -92,6 +95,7 @@ export default class TestRunner extends AbstractCheckRunner {
environment: this.environment,
shouldRecord: this.shouldRecord,
streamLogs: this.streamLogs,
refreshCache: this.refreshCache,
})
const { testSessionId, sequenceIds } = data
const checks = this.checkBundles.map(({ construct: check }) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/services/trigger-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default class TriggerRunner extends AbstractCheckRunner {
environment: string | null
testSessionName: string | undefined
testRetryStrategy: RetryStrategy | null
refreshCache: boolean

constructor (
accountId: string,
Expand All @@ -25,6 +26,7 @@ export default class TriggerRunner extends AbstractCheckRunner {
environment: string | null,
testSessionName: string | undefined,
testRetryStrategy: RetryStrategy | null,
refreshCache?: boolean,
) {
super(accountId, timeout, verbose)
this.shouldRecord = shouldRecord
Expand All @@ -35,6 +37,7 @@ export default class TriggerRunner extends AbstractCheckRunner {
this.environment = environment
this.testSessionName = testSessionName
this.testRetryStrategy = testRetryStrategy
this.refreshCache = refreshCache ?? false
}

async scheduleChecks (
Expand All @@ -53,6 +56,7 @@ export default class TriggerRunner extends AbstractCheckRunner {
repoInfo: this.repoInfo,
environment: this.environment,
testRetryStrategy: this.testRetryStrategy,
refreshCache: this.refreshCache,
})
const {
checks,
Expand Down
Loading