checkly 9.5.0 → 10.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-context/context.js +1 -0
- package/dist/ai-context/context.js.map +1 -1
- package/dist/ai-context/onboarding-boilerplate/checkly-config-template.ts +2 -0
- package/dist/ai-context/public-skills/checkly/SKILL.md +18 -5
- package/dist/ai-context/skills-command/references/communicate.md +6 -3
- package/dist/ai-context/skills-command/references/configure-api-checks.md +1 -9
- package/dist/ai-context/skills-command/references/configure-browser-checks.md +1 -8
- package/dist/ai-context/skills-command/references/configure-check-groups.md +1 -0
- package/dist/ai-context/skills-command/references/configure-dns-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-grpc-monitors.md +24 -0
- package/dist/ai-context/skills-command/references/configure-heartbeat-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-icmp-monitors.md +1 -9
- package/dist/ai-context/skills-command/references/configure-multistep-checks.md +1 -9
- package/dist/ai-context/skills-command/references/configure-playwright-checks.md +1 -1
- package/dist/ai-context/skills-command/references/configure-supporting-constructs.md +6 -2
- package/dist/ai-context/skills-command/references/configure-tcp-monitors.md +1 -10
- package/dist/ai-context/skills-command/references/configure-url-monitors.md +1 -10
- package/dist/ai-context/skills-command/references/configure.md +16 -5
- package/dist/ai-context/skills-command/references/initialize.md +11 -3
- package/dist/ai-context/skills-command/references/investigate-checks.md +1 -1
- package/dist/auth/api-key.d.ts +24 -0
- package/dist/auth/api-key.js +104 -0
- package/dist/auth/api-key.js.map +1 -0
- package/dist/auth/device-flow.d.ts +57 -0
- package/dist/auth/device-flow.js +221 -0
- package/dist/auth/device-flow.js.map +1 -0
- package/dist/auth/index.d.ts +6 -6
- package/dist/auth/index.js +64 -64
- package/dist/auth/index.js.map +1 -1
- package/dist/commands/api.js +43 -10
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/authCommand.d.ts +2 -0
- package/dist/commands/authCommand.js +77 -7
- package/dist/commands/authCommand.js.map +1 -1
- package/dist/commands/debug/parse-project.d.ts +1 -0
- package/dist/commands/debug/parse-project.js +5 -2
- package/dist/commands/debug/parse-project.js.map +1 -1
- package/dist/commands/deploy.d.ts +7 -1
- package/dist/commands/deploy.js +627 -271
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/import/plan.js +18 -4
- package/dist/commands/import/plan.js.map +1 -1
- package/dist/commands/init.js +29 -13
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +18 -2
- package/dist/commands/login.js +681 -48
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +7 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/pw-test.js +3 -2
- package/dist/commands/pw-test.js.map +1 -1
- package/dist/commands/switch.js +23 -10
- package/dist/commands/switch.js.map +1 -1
- package/dist/commands/test.js +16 -17
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/trigger.js +4 -3
- package/dist/commands/trigger.js.map +1 -1
- package/dist/commands/validate.js +1 -0
- package/dist/commands/validate.js.map +1 -1
- package/dist/constants.d.ts +1 -2
- package/dist/constants.js +0 -1
- package/dist/constants.js.map +1 -1
- package/dist/constructs/alert-channel-codegen.d.ts +6 -1
- package/dist/constructs/alert-channel-codegen.js +12 -6
- package/dist/constructs/alert-channel-codegen.js.map +1 -1
- package/dist/constructs/alert-escalation-policy-codegen.d.ts +7 -0
- package/dist/constructs/alert-escalation-policy-codegen.js +25 -8
- package/dist/constructs/alert-escalation-policy-codegen.js.map +1 -1
- package/dist/constructs/api-assertion.d.ts +0 -2
- package/dist/constructs/api-assertion.js +0 -4
- package/dist/constructs/api-assertion.js.map +1 -1
- package/dist/constructs/api-check-codegen.js +1 -1
- package/dist/constructs/api-check-codegen.js.map +1 -1
- package/dist/constructs/api-check.d.ts +4 -22
- package/dist/constructs/api-check.js +15 -17
- package/dist/constructs/api-check.js.map +1 -1
- package/dist/constructs/api-request-codegen.js +10 -8
- package/dist/constructs/api-request-codegen.js.map +1 -1
- package/dist/constructs/browser-check-bundle.d.ts +19 -13
- package/dist/constructs/browser-check-bundle.js +5 -1
- package/dist/constructs/browser-check-bundle.js.map +1 -1
- package/dist/constructs/browser-check.d.ts +1 -4
- package/dist/constructs/browser-check.js +1 -1
- package/dist/constructs/browser-check.js.map +1 -1
- package/dist/constructs/check-codegen.d.ts +39 -14
- package/dist/constructs/check-codegen.js +101 -23
- package/dist/constructs/check-codegen.js.map +1 -1
- package/dist/constructs/check-group-codegen.js +23 -9
- package/dist/constructs/check-group-codegen.js.map +1 -1
- package/dist/constructs/check-group-v1.d.ts +19 -14
- package/dist/constructs/check-group-v1.js +39 -14
- package/dist/constructs/check-group-v1.js.map +1 -1
- package/dist/constructs/check-group-v2.d.ts +0 -20
- package/dist/constructs/check-group-v2.js +0 -4
- package/dist/constructs/check-group-v2.js.map +1 -1
- package/dist/constructs/check.d.ts +45 -32
- package/dist/constructs/check.js +78 -17
- package/dist/constructs/check.js.map +1 -1
- package/dist/constructs/construct-codegen.d.ts +1 -2
- package/dist/constructs/construct-diagnostics.d.ts +3 -0
- package/dist/constructs/construct-diagnostics.js +11 -0
- package/dist/constructs/construct-diagnostics.js.map +1 -1
- package/dist/constructs/construct.d.ts +25 -4
- package/dist/constructs/construct.js +41 -5
- package/dist/constructs/construct.js.map +1 -1
- package/dist/constructs/dns-request-codegen.js +1 -1
- package/dist/constructs/dns-request-codegen.js.map +1 -1
- package/dist/constructs/email-alert-channel-codegen.js +1 -1
- package/dist/constructs/email-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/frequency-codegen.js +10 -2
- package/dist/constructs/frequency-codegen.js.map +1 -1
- package/dist/constructs/frequency.d.ts +8 -3
- package/dist/constructs/frequency.js +7 -2
- package/dist/constructs/frequency.js.map +1 -1
- package/dist/constructs/grpc-monitor.js +19 -0
- package/dist/constructs/grpc-monitor.js.map +1 -1
- package/dist/constructs/grpc-request-codegen.js +13 -4
- package/dist/constructs/grpc-request-codegen.js.map +1 -1
- package/dist/constructs/grpc-request.d.ts +23 -0
- package/dist/constructs/heartbeat-monitor.d.ts +2 -1
- package/dist/constructs/heartbeat-monitor.js +2 -2
- package/dist/constructs/heartbeat-monitor.js.map +1 -1
- package/dist/constructs/icmp-request-codegen.js +1 -1
- package/dist/constructs/icmp-request-codegen.js.map +1 -1
- package/dist/constructs/incidentio-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/incidentio-alert-channel-codegen.js +14 -8
- package/dist/constructs/incidentio-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/index.d.ts +1 -1
- package/dist/constructs/index.js +1 -1
- package/dist/constructs/index.js.map +1 -1
- package/dist/constructs/internal/assertion-validation.js +1 -2
- package/dist/constructs/internal/assertion-validation.js.map +1 -1
- package/dist/constructs/internal/codegen/context.d.ts +73 -6
- package/dist/constructs/internal/codegen/context.js +78 -6
- package/dist/constructs/internal/codegen/context.js.map +1 -1
- package/dist/constructs/internal/codegen/index.d.ts +3 -1
- package/dist/constructs/internal/codegen/index.js +2 -1
- package/dist/constructs/internal/codegen/index.js.map +1 -1
- package/dist/constructs/internal/codegen/render.d.ts +68 -0
- package/dist/constructs/internal/codegen/render.js +75 -0
- package/dist/constructs/internal/codegen/render.js.map +1 -0
- package/dist/constructs/internal/common-diagnostics.d.ts +1 -2
- package/dist/constructs/internal/common-diagnostics.js +6 -14
- package/dist/constructs/internal/common-diagnostics.js.map +1 -1
- package/dist/constructs/internal/declaring-file.d.ts +39 -0
- package/dist/constructs/internal/declaring-file.js +139 -0
- package/dist/constructs/internal/declaring-file.js.map +1 -0
- package/dist/constructs/internal/retry-strategy-defaults.d.ts +13 -0
- package/dist/constructs/internal/retry-strategy-defaults.js +14 -0
- package/dist/constructs/internal/retry-strategy-defaults.js.map +1 -0
- package/dist/constructs/key-value-pair-codegen.d.ts +6 -1
- package/dist/constructs/key-value-pair-codegen.js +24 -3
- package/dist/constructs/key-value-pair-codegen.js.map +1 -1
- package/dist/constructs/maintenance-window-codegen.d.ts +7 -0
- package/dist/constructs/maintenance-window-codegen.js +36 -19
- package/dist/constructs/maintenance-window-codegen.js.map +1 -1
- package/dist/constructs/maintenance-window.d.ts +35 -3
- package/dist/constructs/maintenance-window.js +35 -1
- package/dist/constructs/maintenance-window.js.map +1 -1
- package/dist/constructs/monitor.d.ts +1 -1
- package/dist/constructs/msteams-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/msteams-alert-channel-codegen.js +8 -18
- package/dist/constructs/msteams-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/opsgenie-alert-channel-codegen.js +1 -1
- package/dist/constructs/opsgenie-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/pagerduty-alert-channel-codegen.js +1 -1
- package/dist/constructs/pagerduty-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/phone-call-alert-channel-codegen.js +1 -1
- package/dist/constructs/phone-call-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/playwright-check-bundle.d.ts +7 -1
- package/dist/constructs/playwright-check-bundle.js +3 -0
- package/dist/constructs/playwright-check-bundle.js.map +1 -1
- package/dist/constructs/playwright-check-codegen.d.ts +85 -0
- package/dist/constructs/playwright-check-codegen.js +212 -0
- package/dist/constructs/playwright-check-codegen.js.map +1 -0
- package/dist/constructs/playwright-check.d.ts +14 -24
- package/dist/constructs/playwright-check.js +16 -52
- package/dist/constructs/playwright-check.js.map +1 -1
- package/dist/constructs/retry-strategy-codegen.d.ts +7 -1
- package/dist/constructs/retry-strategy-codegen.js +41 -32
- package/dist/constructs/retry-strategy-codegen.js.map +1 -1
- package/dist/constructs/retry-strategy.d.ts +0 -4
- package/dist/constructs/retry-strategy.js +5 -8
- package/dist/constructs/retry-strategy.js.map +1 -1
- package/dist/constructs/session.d.ts +26 -1
- package/dist/constructs/session.js +33 -2
- package/dist/constructs/session.js.map +1 -1
- package/dist/constructs/slack-alert-channel-codegen.js +1 -1
- package/dist/constructs/slack-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/slack-app-alert-channel-codegen.js +1 -1
- package/dist/constructs/slack-app-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/sms-alert-channel-codegen.js +1 -1
- package/dist/constructs/sms-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/ssl-request-codegen.js +4 -3
- package/dist/constructs/ssl-request-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-automation-rule-codegen.js +5 -4
- package/dist/constructs/status-page-v3-automation-rule-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-codegen.js +3 -2
- package/dist/constructs/status-page-v3-codegen.js.map +1 -1
- package/dist/constructs/status-page-v3-component-codegen.js +8 -7
- package/dist/constructs/status-page-v3-component-codegen.js.map +1 -1
- package/dist/constructs/tcp-monitor-codegen.js +3 -2
- package/dist/constructs/tcp-monitor-codegen.js.map +1 -1
- package/dist/constructs/tcp-monitor.d.ts +4 -3
- package/dist/constructs/tcp-monitor.js +3 -2
- package/dist/constructs/tcp-monitor.js.map +1 -1
- package/dist/constructs/telegram-alert-channel-codegen.d.ts +1 -1
- package/dist/constructs/telegram-alert-channel-codegen.js +14 -8
- package/dist/constructs/telegram-alert-channel-codegen.js.map +1 -1
- package/dist/constructs/time-zone.d.ts +24 -0
- package/dist/constructs/time-zone.js +455 -0
- package/dist/constructs/time-zone.js.map +1 -0
- package/dist/constructs/traceroute-request-codegen.js +2 -2
- package/dist/constructs/traceroute-request-codegen.js.map +1 -1
- package/dist/constructs/url-monitor-codegen.js +1 -1
- package/dist/constructs/url-monitor-codegen.js.map +1 -1
- package/dist/constructs/url-monitor.d.ts +3 -2
- package/dist/constructs/url-monitor.js +3 -0
- package/dist/constructs/url-monitor.js.map +1 -1
- package/dist/constructs/url-request-codegen.js +4 -3
- package/dist/constructs/url-request-codegen.js.map +1 -1
- package/dist/constructs/webhook-alert-channel-codegen.js +3 -3
- package/dist/constructs/webhook-alert-channel-codegen.js.map +1 -1
- package/dist/formatters/check-result-detail.js +0 -185
- package/dist/formatters/check-result-detail.js.map +1 -1
- package/dist/helpers/activate-account.d.ts +14 -0
- package/dist/helpers/activate-account.js +25 -0
- package/dist/helpers/activate-account.js.map +1 -0
- package/dist/helpers/cli-mode.d.ts +18 -0
- package/dist/helpers/cli-mode.js +41 -2
- package/dist/helpers/cli-mode.js.map +1 -1
- package/dist/helpers/command-preview.d.ts +44 -0
- package/dist/helpers/command-preview.js +29 -9
- package/dist/helpers/command-preview.js.map +1 -1
- package/dist/helpers/flags.d.ts +10 -0
- package/dist/helpers/flags.js +17 -0
- package/dist/helpers/flags.js.map +1 -1
- package/dist/helpers/onboarding/boilerplate.js +13 -1
- package/dist/helpers/onboarding/boilerplate.js.map +1 -1
- package/dist/helpers/onboarding/index.d.ts +1 -1
- package/dist/helpers/onboarding/index.js +1 -1
- package/dist/helpers/onboarding/index.js.map +1 -1
- package/dist/helpers/onboarding/messages.d.ts +6 -0
- package/dist/helpers/onboarding/messages.js +14 -0
- package/dist/helpers/onboarding/messages.js.map +1 -1
- package/dist/helpers/onboarding/skill-install.js +2 -2
- package/dist/helpers/onboarding/skill-install.js.map +1 -1
- package/dist/helpers/wrap.js +1 -1
- package/dist/helpers/wrap.js.map +1 -1
- package/dist/reporters/abstract-list.js +11 -2
- package/dist/reporters/abstract-list.js.map +1 -1
- package/dist/reporters/github.js +3 -2
- package/dist/reporters/github.js.map +1 -1
- package/dist/reporters/util.d.ts +1 -0
- package/dist/reporters/util.js +5 -58
- package/dist/reporters/util.js.map +1 -1
- package/dist/rest/analytics.js +0 -4
- package/dist/rest/analytics.js.map +1 -1
- package/dist/rest/api.d.ts +8 -1
- package/dist/rest/api.js +21 -3
- package/dist/rest/api.js.map +1 -1
- package/dist/rest/check-results.d.ts +1 -50
- package/dist/rest/check-results.js.map +1 -1
- package/dist/rest/checkly-storage.d.ts +6 -1
- package/dist/rest/checkly-storage.js +13 -2
- package/dist/rest/checkly-storage.js.map +1 -1
- package/dist/rest/errors.d.ts +13 -0
- package/dist/rest/errors.js +5 -1
- package/dist/rest/errors.js.map +1 -1
- package/dist/rest/projects.d.ts +254 -4
- package/dist/rest/projects.js +184 -12
- package/dist/rest/projects.js.map +1 -1
- package/dist/services/abstract-check-runner.d.ts +11 -0
- package/dist/services/abstract-check-runner.js +98 -46
- package/dist/services/abstract-check-runner.js.map +1 -1
- package/dist/services/check-parser/bundler.d.ts +26 -0
- package/dist/services/check-parser/bundler.js +81 -7
- package/dist/services/check-parser/bundler.js.map +1 -1
- package/dist/services/check-parser/cache-hash.d.ts +1 -4
- package/dist/services/check-parser/cache-hash.js.map +1 -1
- package/dist/services/checkly-config-codegen.js +1 -4
- package/dist/services/checkly-config-codegen.js.map +1 -1
- package/dist/services/checkly-config-loader.d.ts +7 -33
- package/dist/services/checkly-config-loader.js +50 -47
- package/dist/services/checkly-config-loader.js.map +1 -1
- package/dist/services/config.d.ts +2 -0
- package/dist/services/config.js +14 -0
- package/dist/services/config.js.map +1 -1
- package/dist/services/content-hash.d.ts +14 -0
- package/dist/services/content-hash.js +22 -0
- package/dist/services/content-hash.js.map +1 -0
- package/dist/services/deploy-diff/diff-lines.d.ts +38 -0
- package/dist/services/deploy-diff/diff-lines.js +191 -0
- package/dist/services/deploy-diff/diff-lines.js.map +1 -0
- package/dist/services/deploy-diff/import-shape.d.ts +171 -0
- package/dist/services/deploy-diff/import-shape.js +633 -0
- package/dist/services/deploy-diff/import-shape.js.map +1 -0
- package/dist/services/deploy-diff/legacy-payload.d.ts +22 -0
- package/dist/services/deploy-diff/legacy-payload.js +51 -0
- package/dist/services/deploy-diff/legacy-payload.js.map +1 -0
- package/dist/services/deploy-diff/plan-summary.d.ts +37 -0
- package/dist/services/deploy-diff/plan-summary.js +154 -0
- package/dist/services/deploy-diff/plan-summary.js.map +1 -0
- package/dist/services/deploy-diff/preview-output.d.ts +61 -0
- package/dist/services/deploy-diff/preview-output.js +394 -0
- package/dist/services/deploy-diff/preview-output.js.map +1 -0
- package/dist/services/deploy-diff/render.d.ts +53 -0
- package/dist/services/deploy-diff/render.js +317 -0
- package/dist/services/deploy-diff/render.js.map +1 -0
- package/dist/services/deploy-diff/shape-changes.d.ts +2 -0
- package/dist/services/deploy-diff/shape-changes.js +35 -0
- package/dist/services/deploy-diff/shape-changes.js.map +1 -0
- package/dist/services/deploy-diff/source-index.d.ts +18 -0
- package/dist/services/deploy-diff/source-index.js +48 -0
- package/dist/services/deploy-diff/source-index.js.map +1 -0
- package/dist/services/deploy-diff/variable-names.d.ts +30 -0
- package/dist/services/deploy-diff/variable-names.js +64 -0
- package/dist/services/deploy-diff/variable-names.js.map +1 -0
- package/dist/services/project-parser.d.ts +5 -0
- package/dist/services/project-parser.js +25 -13
- package/dist/services/project-parser.js.map +1 -1
- package/dist/services/snapshot-service.d.ts +25 -8
- package/dist/services/snapshot-service.js +46 -4
- package/dist/services/snapshot-service.js.map +1 -1
- package/dist/services/test-filters.d.ts +18 -0
- package/dist/services/test-filters.js +10 -0
- package/dist/services/test-filters.js.map +1 -1
- package/dist/services/test-runner.js +7 -3
- package/dist/services/test-runner.js.map +1 -1
- package/dist/services/test-session-cancel.js +1 -1
- package/dist/services/test-session-cancel.js.map +1 -1
- package/dist/services/util.d.ts +17 -2
- package/dist/services/util.js +118 -11
- package/dist/services/util.js.map +1 -1
- package/dist/services/write-back/apply-edits.d.ts +29 -0
- package/dist/services/write-back/apply-edits.js +255 -0
- package/dist/services/write-back/apply-edits.js.map +1 -0
- package/dist/services/write-back/helper-edit.d.ts +135 -0
- package/dist/services/write-back/helper-edit.js +343 -0
- package/dist/services/write-back/helper-edit.js.map +1 -0
- package/dist/services/write-back/imports.d.ts +30 -0
- package/dist/services/write-back/imports.js +82 -0
- package/dist/services/write-back/imports.js.map +1 -0
- package/dist/services/write-back/literal-edit.d.ts +183 -0
- package/dist/services/write-back/literal-edit.js +359 -0
- package/dist/services/write-back/literal-edit.js.map +1 -0
- package/dist/services/write-back/output.d.ts +26 -0
- package/dist/services/write-back/output.js +110 -0
- package/dist/services/write-back/output.js.map +1 -0
- package/dist/services/write-back/plan.d.ts +173 -0
- package/dist/services/write-back/plan.js +968 -0
- package/dist/services/write-back/plan.js.map +1 -0
- package/dist/services/write-back/source-file.d.ts +118 -0
- package/dist/services/write-back/source-file.js +432 -0
- package/dist/services/write-back/source-file.js.map +1 -0
- package/dist/sourcegen/index.d.ts +1 -1
- package/dist/sourcegen/index.js +1 -1
- package/dist/sourcegen/index.js.map +1 -1
- package/dist/sourcegen/program.d.ts +19 -1
- package/dist/sourcegen/program.js +32 -7
- package/dist/sourcegen/program.js.map +1 -1
- package/oclif.manifest.json +676 -635
- package/package.json +13 -13
- package/dist/commands/rules.d.ts +0 -9
- package/dist/commands/rules.js +0 -13
- package/dist/commands/rules.js.map +0 -1
- package/dist/constructs/agentic-check-codegen.d.ts +0 -22
- package/dist/constructs/agentic-check-codegen.js +0 -59
- package/dist/constructs/agentic-check-codegen.js.map +0 -1
- package/dist/constructs/agentic-check.d.ts +0 -237
- package/dist/constructs/agentic-check.js +0 -100
- package/dist/constructs/agentic-check.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
1
2
|
import * as path from 'path';
|
|
2
3
|
import Debug from 'debug';
|
|
3
4
|
import { findFilesWithPattern, getPlaywrightConfigPath, pathToPosix, } from './util.js';
|
|
@@ -60,7 +61,14 @@ async function findBasePath(packageManager, directory, { ignoreWorkspaces = fals
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
export async function parseProject(opts) {
|
|
63
|
-
const { directory, checkMatch = '**/*.check.{js,ts}', checkFilter, includeTestOnlyChecks = false, browserCheckMatch, multiStepCheckMatch, projectLogicalId, projectName, repoUrl, ignoreDirectoriesMatch = [], checkDefaults = {}, browserCheckDefaults = {}, availableRuntimes, defaultRuntimeId, verifyRuntimeDependencies, checklyConfigConstructs, playwrightConfigPath, include, embeddedPackages, playwrightChecks, loadPlaywrightChecksOnly, warnOnWebServerConfig, enableWorkspaces = true, } = opts;
|
|
64
|
+
const { directory: givenDirectory, checkMatch = '**/*.check.{js,ts}', checkFilter, includeTestOnlyChecks = false, browserCheckMatch, multiStepCheckMatch, projectLogicalId, projectName, repoUrl, ignoreDirectoriesMatch = [], checkDefaults = {}, browserCheckDefaults = {}, availableRuntimes, defaultRuntimeId, verifyRuntimeDependencies, checklyConfigConstructs, playwrightConfigPath, include, embeddedPackages, playwrightChecks, loadPlaywrightChecksOnly, warnOnWebServerConfig, enableWorkspaces = true, warnOnMissingCheckLocations, } = opts;
|
|
65
|
+
// Constructs learn their declaring file from the call stack, and module
|
|
66
|
+
// loaders report files at their physical location, with symlinks resolved.
|
|
67
|
+
// Every path derived from the directory below (the base path, the glob
|
|
68
|
+
// results, the check-file paths) must be physical too, or a check file
|
|
69
|
+
// reached through a symlink would compare unequal to the same file seen
|
|
70
|
+
// from a construct.
|
|
71
|
+
const directory = await fs.realpath(givenDirectory);
|
|
64
72
|
const project = new Project(projectLogicalId, {
|
|
65
73
|
name: projectName,
|
|
66
74
|
repoUrl,
|
|
@@ -80,6 +88,7 @@ export async function parseProject(opts) {
|
|
|
80
88
|
Session.project = project;
|
|
81
89
|
Session.basePath = basePath;
|
|
82
90
|
Session.contextPath = contextPath;
|
|
91
|
+
Session.checkFilesDirectory = directory;
|
|
83
92
|
Session.checkDefaults = Object.assign({}, BASE_CHECK_DEFAULTS, checkDefaults);
|
|
84
93
|
Session.checkFilter = checkFilter;
|
|
85
94
|
Session.browserCheckDefaults = browserCheckDefaults;
|
|
@@ -92,14 +101,16 @@ export async function parseProject(opts) {
|
|
|
92
101
|
// repeated in-process parse with different options must not reuse it.
|
|
93
102
|
Session.embeddedPackagesMaterializer = undefined;
|
|
94
103
|
Session.warnOnWebServerConfig = warnOnWebServerConfig;
|
|
104
|
+
Session.warnOnMissingCheckLocations = warnOnMissingCheckLocations ?? false;
|
|
95
105
|
Session.packageManager = packageManager;
|
|
96
106
|
Session.workspace = workspace;
|
|
97
107
|
// TODO: Do we really need all of the ** globs, or could we just put node_modules?
|
|
98
108
|
const ignoreDirectories = ['**/node_modules/**', '**/.git/**', ...ignoreDirectoriesMatch];
|
|
99
109
|
if (!loadPlaywrightChecksOnly) {
|
|
100
110
|
await loadAllCheckFiles(directory, checkMatch, ignoreDirectories);
|
|
101
|
-
// Load sequentially
|
|
102
|
-
//
|
|
111
|
+
// Load sequentially: Session.checkFileAbsolutePath names the file being
|
|
112
|
+
// loaded, which constructs without a user frame on the call stack fall
|
|
113
|
+
// back to.
|
|
103
114
|
await loadAllBrowserChecks(directory, browserCheckMatch, ignoreDirectories, project);
|
|
104
115
|
await loadAllMultiStepChecks(directory, multiStepCheckMatch, ignoreDirectories, project);
|
|
105
116
|
}
|
|
@@ -108,14 +119,15 @@ export async function parseProject(opts) {
|
|
|
108
119
|
await loadAllPrivateLocationsSlugNames(project);
|
|
109
120
|
return project;
|
|
110
121
|
}
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Marks `checkFile` as the file being loaded and returns its path relative
|
|
124
|
+
* to the parse directory, with posix separators.
|
|
125
|
+
*/
|
|
126
|
+
function setCheckFilePaths(checkFile) {
|
|
113
127
|
Session.checkFileAbsolutePath = checkFile;
|
|
114
|
-
Session.
|
|
115
|
-
return relPath;
|
|
128
|
+
return Session.relativeCheckFilePath(checkFile);
|
|
116
129
|
}
|
|
117
130
|
function resetCheckFilePaths() {
|
|
118
|
-
Session.checkFilePath = undefined;
|
|
119
131
|
Session.checkFileAbsolutePath = undefined;
|
|
120
132
|
}
|
|
121
133
|
// eslint-disable-next-line require-await
|
|
@@ -124,7 +136,7 @@ async function loadPlaywrightChecks(directory, playwrightChecks, playwrightConfi
|
|
|
124
136
|
try {
|
|
125
137
|
for (const playwrightCheckProps of playwrightChecks) {
|
|
126
138
|
const configPath = getPlaywrightConfigPath(playwrightCheckProps, playwrightConfigPath, directory);
|
|
127
|
-
setCheckFilePaths(configPath
|
|
139
|
+
setCheckFilePaths(configPath);
|
|
128
140
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
129
141
|
const playwrightCheck = new PlaywrightCheck(playwrightCheckProps.logicalId, {
|
|
130
142
|
...playwrightCheckProps,
|
|
@@ -142,7 +154,7 @@ async function loadPlaywrightChecks(directory, playwrightChecks, playwrightConfi
|
|
|
142
154
|
if (!playwrightConfigPath) {
|
|
143
155
|
return;
|
|
144
156
|
}
|
|
145
|
-
setCheckFilePaths(playwrightConfigPath
|
|
157
|
+
setCheckFilePaths(playwrightConfigPath);
|
|
146
158
|
const resolvedPlaywrightConfigPath = path.resolve(directory, playwrightConfigPath);
|
|
147
159
|
const basePath = path.basename(resolvedPlaywrightConfigPath);
|
|
148
160
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -161,7 +173,7 @@ async function loadAllCheckFiles(directory, checkFilePattern, ignorePattern) {
|
|
|
161
173
|
const checkFiles = await findFilesWithPattern(directory, checkFilePattern, ignorePattern);
|
|
162
174
|
for (const checkFile of checkFiles) {
|
|
163
175
|
try {
|
|
164
|
-
setCheckFilePaths(checkFile
|
|
176
|
+
setCheckFilePaths(checkFile);
|
|
165
177
|
await Session.loadFile(checkFile);
|
|
166
178
|
}
|
|
167
179
|
finally {
|
|
@@ -195,7 +207,7 @@ async function loadAllBrowserChecks(directory, browserCheckFilePattern, ignorePa
|
|
|
195
207
|
const preexistingCheckFiles = getExistingEntrypoints(project);
|
|
196
208
|
for (const checkFile of checkFiles) {
|
|
197
209
|
try {
|
|
198
|
-
const relPath = setCheckFilePaths(checkFile
|
|
210
|
+
const relPath = setCheckFilePaths(checkFile);
|
|
199
211
|
// Don't create an additional check if the checkFile was already added
|
|
200
212
|
// to a check in loadAllCheckFiles.
|
|
201
213
|
if (preexistingCheckFiles.has(relPath)) {
|
|
@@ -222,7 +234,7 @@ async function loadAllMultiStepChecks(directory, multiStepCheckFilePattern, igno
|
|
|
222
234
|
const preexistingCheckFiles = getExistingEntrypoints(project);
|
|
223
235
|
for (const checkFile of checkFiles) {
|
|
224
236
|
try {
|
|
225
|
-
const relPath = setCheckFilePaths(checkFile
|
|
237
|
+
const relPath = setCheckFilePaths(checkFile);
|
|
226
238
|
// Don't create an additional check if the checkFile was already added
|
|
227
239
|
// to a check in loadAllCheckFiles.
|
|
228
240
|
if (preexistingCheckFiles.has(relPath)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-parser.js","sourceRoot":"","sources":["../../src/services/project-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,oBAAoB,EAAE,uBAAuB,EAC7C,WAAW,GACZ,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,EAAE,YAAY,EAAc,OAAO,EAAE,OAAO,EACjD,eAAe,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,cAAc,GAEhG,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAE1C,OAAO,EAAE,YAAY,EAAkB,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,4BAA4B,EAC5B,uBAAuB,GAExB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,wCAAwC,CAAA;AAIxE,MAAM,KAAK,GAAG,KAAK,CAAC,qCAAqC,CAAC,CAAA;AA4B1D,MAAM,mBAAmB,GAAG,EAC3B,CAAA;AAED,KAAK,UAAU,YAAY,CACzB,cAA8B,EAC9B,SAAiB,EACjB,EAAE,gBAAgB,GAAG,KAAK,EAAE;IAM5B,IAAI,CAAC;QACH,IAAI,gBAAgB,EAAE,CAAC;YACrB,MAAM,kBAAkB,GAAG,MAAM,wBAAwB,CAAC,SAAS,CAAC,CAAA;YAEpE,MAAM,SAAS,GAAG,MAAM,4BAA4B,CAClD,cAAc,EACd,kBAAkB,CACnB,CAAA;YAED,O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OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,KAAK,eAAe,CAAC,EAAE,CAAC,CAAA;YACtI,IAAI,wBAAgC,CAAA;YACpC,IAAI,CAAC,6BAA6B,EAAE,CAAC;gBACnC,MAAM,wBAAwB,GAAG,eAAe,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;gBAC3E,wBAAwB,GAAG,wBAAwB,CAAC,SAAS,CAAA;YAC/D,CAAC;iBAAM,CAAC;gBACN,wBAAwB,GAAG,6BAA6B,CAAC,SAAS,CAAA;YACpE,CAAC;YAED,+CAA+C;YAC/C,6DAA6D;YAC7D,MAAM,UAAU,GAAG,QAAQ,YAAY,KAAK;gBAC1C,CAAC,CAAC,IAAI,8BAA8B,CAAC,qCAAqC,QAAQ,CAAC,SAAS,IAAI,wBAAwB,EAAE,EAAE;oBACxH,iBAAiB,EAAE,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC;oBACrD,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;iBACtC,CAAC;gBACJ,CAAC,CAAC,IAAI,8BAA8B,CAAC,qCAAqC,QAAQ,CAAC,SAAS,IAAI,wBAAwB,EAAE,EAAE;oBACxH,iBAAiB,EAAE,GAAG,CAAC,IAAI,CAAC,wBAAwB,CAAC;oBACrD,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;iBACtC,CAAC,CAAA;QACR,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A snapshot file as it exists locally, before any upload. `sha256` describes
|
|
3
|
+
* the file's content, so a snapshot can be reported to Checkly — in a deploy
|
|
4
|
+
* preview, for instance — while `key`, which only the upload produces, is
|
|
5
|
+
* still unknown.
|
|
6
|
+
*/
|
|
7
|
+
export interface RawSnapshot {
|
|
8
|
+
absolutePath: string;
|
|
9
|
+
path: string;
|
|
10
|
+
sha256: string;
|
|
11
|
+
}
|
|
1
12
|
export interface Snapshot {
|
|
2
13
|
key: string;
|
|
3
14
|
path: string;
|
|
15
|
+
/** Absent on snapshots read back from the API, which only stores it on deploy. */
|
|
16
|
+
sha256?: string;
|
|
4
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* The content hashes only a deploy sends.
|
|
20
|
+
*
|
|
21
|
+
* A check's payload is synthesized the same way for a deploy and for a test
|
|
22
|
+
* session, but only the deploy compares content hashes — and only the deploy
|
|
23
|
+
* schemas accept them. Keeping them out of a run request means a CLI published
|
|
24
|
+
* before the matching API is deployed still runs tests, rather than having
|
|
25
|
+
* every browser check with snapshots and every Playwright suite rejected.
|
|
26
|
+
*/
|
|
27
|
+
export declare function stripContentHashes<T extends Record<string, unknown>>(payload: T): T;
|
|
5
28
|
export declare function pullSnapshots(basePath: string, snapshots?: Snapshot[] | null): Promise<void>;
|
|
6
|
-
export declare function detectSnapshots(projectBasePath: string, scriptFilePath: string):
|
|
7
|
-
|
|
8
|
-
path: string;
|
|
9
|
-
}[];
|
|
10
|
-
export declare function uploadSnapshots(rawSnapshots?: Array<{
|
|
11
|
-
absolutePath: string;
|
|
12
|
-
path: string;
|
|
13
|
-
}>): Promise<Snapshot[]>;
|
|
29
|
+
export declare function detectSnapshots(projectBasePath: string, scriptFilePath: string): Promise<RawSnapshot[]>;
|
|
30
|
+
export declare function uploadSnapshots(rawSnapshots?: RawSnapshot[]): Promise<Snapshot[]>;
|
|
@@ -2,8 +2,33 @@ import * as fsAsync from 'node:fs/promises';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import * as stream from 'node:stream/promises';
|
|
5
|
+
import PQueue from 'p-queue';
|
|
5
6
|
import { checklyStorage } from '../rest/api.js';
|
|
7
|
+
import { sha256OfFile } from './content-hash.js';
|
|
6
8
|
import { findFilesRecursively, pathToPosix } from './util.js';
|
|
9
|
+
/** How many snapshot files are hashed at once. */
|
|
10
|
+
const SNAPSHOT_HASH_CONCURRENCY = 8;
|
|
11
|
+
/**
|
|
12
|
+
* The content hashes only a deploy sends.
|
|
13
|
+
*
|
|
14
|
+
* A check's payload is synthesized the same way for a deploy and for a test
|
|
15
|
+
* session, but only the deploy compares content hashes — and only the deploy
|
|
16
|
+
* schemas accept them. Keeping them out of a run request means a CLI published
|
|
17
|
+
* before the matching API is deployed still runs tests, rather than having
|
|
18
|
+
* every browser check with snapshots and every Playwright suite rejected.
|
|
19
|
+
*/
|
|
20
|
+
export function stripContentHashes(payload) {
|
|
21
|
+
const stripped = { ...payload };
|
|
22
|
+
delete stripped.codeBundleSha256;
|
|
23
|
+
if (Array.isArray(stripped.snapshots)) {
|
|
24
|
+
stripped.snapshots = stripped.snapshots.map(snapshot => {
|
|
25
|
+
const entry = { ...snapshot };
|
|
26
|
+
delete entry.sha256;
|
|
27
|
+
return entry;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return stripped;
|
|
31
|
+
}
|
|
7
32
|
export async function pullSnapshots(basePath, snapshots) {
|
|
8
33
|
if (!snapshots?.length) {
|
|
9
34
|
return;
|
|
@@ -26,15 +51,21 @@ export async function pullSnapshots(basePath, snapshots) {
|
|
|
26
51
|
throw new Error(`Error downloading snapshots: ${err.message}`, { cause: err });
|
|
27
52
|
}
|
|
28
53
|
}
|
|
29
|
-
export function detectSnapshots(projectBasePath, scriptFilePath) {
|
|
54
|
+
export async function detectSnapshots(projectBasePath, scriptFilePath) {
|
|
30
55
|
// By default, PWT will store snapshots in the `script.spec.js-snapshots` directory.
|
|
31
56
|
// Other paths can be configured, though, and we should add support for those as well.
|
|
32
57
|
// https://playwright.dev/docs/api/class-testconfig#test-config-snapshot-path-template
|
|
33
58
|
const snapshotFiles = findFilesRecursively(`${scriptFilePath}-snapshots`);
|
|
34
|
-
|
|
59
|
+
// Hashed here rather than at upload time so the hash is available whether or
|
|
60
|
+
// not the snapshot is ever uploaded (see {@link RawSnapshot}). Bounded,
|
|
61
|
+
// because each hash opens a read stream and a project can hold hundreds of
|
|
62
|
+
// baselines across as many checks as it has.
|
|
63
|
+
const queue = new PQueue({ concurrency: SNAPSHOT_HASH_CONCURRENCY });
|
|
64
|
+
return await Promise.all(snapshotFiles.map(absolutePath => queue.add(async () => ({
|
|
35
65
|
absolutePath,
|
|
36
66
|
path: pathToPosix(path.relative(projectBasePath, absolutePath)),
|
|
37
|
-
|
|
67
|
+
sha256: await sha256OfFile(absolutePath),
|
|
68
|
+
}))));
|
|
38
69
|
}
|
|
39
70
|
export async function uploadSnapshots(rawSnapshots) {
|
|
40
71
|
if (!rawSnapshots?.length) {
|
|
@@ -43,9 +74,20 @@ export async function uploadSnapshots(rawSnapshots) {
|
|
|
43
74
|
try {
|
|
44
75
|
const snapshots = [];
|
|
45
76
|
for (const rawSnapshot of rawSnapshots) {
|
|
77
|
+
// Re-hashed rather than reusing the hash from detection: a deploy asks
|
|
78
|
+
// what it would change before it uploads, and the answer has to be
|
|
79
|
+
// confirmed first, so the file may have been edited in between. The hash
|
|
80
|
+
// that ships with the upload describes what was uploaded.
|
|
81
|
+
const sha256 = await sha256OfFile(rawSnapshot.absolutePath);
|
|
82
|
+
if (sha256 !== rawSnapshot.sha256) {
|
|
83
|
+
// The plan the user just saw described the older content, so say which
|
|
84
|
+
// file moved rather than quietly deploying something else.
|
|
85
|
+
process.stderr.write(`Warning: ${rawSnapshot.path} changed after the deploy was planned; `
|
|
86
|
+
+ 'the content being uploaded is the one on disk now.\n');
|
|
87
|
+
}
|
|
46
88
|
const snapshotStream = fs.createReadStream(rawSnapshot.absolutePath);
|
|
47
89
|
const { data: { key } } = await checklyStorage.upload(snapshotStream);
|
|
48
|
-
snapshots.push({ key, path: rawSnapshot.path });
|
|
90
|
+
snapshots.push({ key, path: rawSnapshot.path, sha256 });
|
|
49
91
|
}
|
|
50
92
|
return snapshots;
|
|
51
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot-service.js","sourceRoot":"","sources":["../../src/services/snapshot-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"snapshot-service.js","sourceRoot":"","sources":["../../src/services/snapshot-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAA;AAE9C,OAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE7D,kDAAkD;AAClD,MAAM,yBAAyB,GAAG,CAAC,CAAA;AAqBnC;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAqC,OAAU;IAC/E,MAAM,QAAQ,GAA4B,EAAE,GAAG,OAAO,EAAE,CAAA;IACxD,OAAO,QAAQ,CAAC,gBAAgB,CAAA;IAEhC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACtC,QAAQ,CAAC,SAAS,GAAI,QAAQ,CAAC,SAAwB,CAAC,GA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sDAAsD,CACzD,CAAA;YACH,CAAC;YACD,MAAM,cAAc,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;YACpE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;YACrE,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAA;QACzD,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
export declare function filterByCheckNamePattern(checkNamePattern: string | undefined, checkName: string): boolean;
|
|
2
2
|
export declare function filterByFileNamePattern(filePatterns: Array<string> | undefined, path: string | undefined): boolean;
|
|
3
|
+
/** The files a check can be selected by with `checkly test <file>`. */
|
|
4
|
+
export interface CheckFiles {
|
|
5
|
+
/** The file that declares the check, relative to the parse directory. */
|
|
6
|
+
sourceFile?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The check file that was being loaded when the check was created,
|
|
9
|
+
* relative to the parse directory; differs from `sourceFile` when a
|
|
10
|
+
* module the check file imports, or a helper it calls, declares the check.
|
|
11
|
+
*/
|
|
12
|
+
loadedFrom?: string;
|
|
13
|
+
/** A browser or multistep check's script, relative to the base path. */
|
|
14
|
+
entrypoint?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Whether one of the file patterns names the check: by the file that
|
|
18
|
+
* declares it, by the check file that loaded it, or by its script.
|
|
19
|
+
*/
|
|
20
|
+
export declare function filterByCheckFiles(filePatterns: Array<string> | undefined, files: CheckFiles): boolean;
|
|
3
21
|
export declare function filterByTags(targetTags: string[][], tags: string[] | undefined): boolean;
|
|
@@ -8,6 +8,16 @@ export function filterByFileNamePattern(filePatterns = [], path) {
|
|
|
8
8
|
return re.test(path);
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether one of the file patterns names the check: by the file that
|
|
13
|
+
* declares it, by the check file that loaded it, or by its script.
|
|
14
|
+
*/
|
|
15
|
+
export function filterByCheckFiles(filePatterns = [], files) {
|
|
16
|
+
// A file that is unknown is not matched by anything, not even a pattern
|
|
17
|
+
// that happens to match the word "undefined".
|
|
18
|
+
return [files.entrypoint, files.sourceFile, files.loadedFrom]
|
|
19
|
+
.some(file => file !== undefined && filterByFileNamePattern(filePatterns, file));
|
|
20
|
+
}
|
|
11
21
|
export function filterByTags(targetTags, tags) {
|
|
12
22
|
if (targetTags?.length > 0 && tags) {
|
|
13
23
|
return targetTags.some(targetTagSet => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-filters.js","sourceRoot":"","sources":["../../src/services/test-filters.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,wBAAwB,CAAE,gBAAgB,GAAG,EAAE,EAAE,SAAiB;IAChF,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAA;IACvC,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAE,eAA8B,EAAE,EAAE,IAAwB;IACjG,OAAO,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;QACvC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,CAAA;QAClC,OAAO,EAAE,CAAC,IAAI,CAAC,IAAW,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAE,UAAsB,EAAE,IAA0B;IAC9E,IAAI,UAAU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IAC9E,IAAI,UAAU,EAAE,MAAM,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,OAAO,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YACpC,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as uuid from 'uuid';
|
|
2
2
|
import { testSessions } from '../rest/api.js';
|
|
3
3
|
import AbstractCheckRunner from './abstract-check-runner.js';
|
|
4
|
-
import { pullSnapshots } from '../services/snapshot-service.js';
|
|
4
|
+
import { pullSnapshots, stripContentHashes } from '../services/snapshot-service.js';
|
|
5
5
|
import { PlaywrightCheckBundle } from '../constructs/playwright-check-bundle.js';
|
|
6
6
|
export default class TestRunner extends AbstractCheckRunner {
|
|
7
7
|
projectBundle;
|
|
@@ -39,9 +39,13 @@ export default class TestRunner extends AbstractCheckRunner {
|
|
|
39
39
|
? bundle.groupId
|
|
40
40
|
: check.groupId;
|
|
41
41
|
return {
|
|
42
|
-
|
|
42
|
+
// The content hashes describe uploads for a deploy to compare; a run
|
|
43
|
+
// has no use for them and a run route may not accept them.
|
|
44
|
+
...stripContentHashes(bundle.synthesize()),
|
|
43
45
|
testRetryStrategy: this.testRetryStrategy,
|
|
44
|
-
group: groupId
|
|
46
|
+
group: groupId
|
|
47
|
+
? stripContentHashes(this.projectBundle.data['check-group'][groupId.ref].bundle.synthesize())
|
|
48
|
+
: undefined,
|
|
45
49
|
sourceInfo: {
|
|
46
50
|
checkRunSuiteId,
|
|
47
51
|
checkRunId: uuid.v4(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-runner.js","sourceRoot":"","sources":["../../src/services/test-runner.ts"],"names":[],"mappings":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AAa,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -7,7 +7,7 @@ export function registerTestSessionCancelHandler(runner, reporters, cancelClient
|
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
// Cancellation is intentionally test-session scoped. The backend resolves
|
|
10
|
-
// which running results are cancellable (currently Playwright
|
|
10
|
+
// which running results are cancellable (currently Playwright),
|
|
11
11
|
// so the CLI must not narrow the request by check type or sequence ID here.
|
|
12
12
|
await cancelClient.cancelTestSession({ testSessionId });
|
|
13
13
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-session-cancel.js","sourceRoot":"","sources":["../../src/services/test-session-cancel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAUnD,MAAM,UAAU,gCAAgC,CAC9C,MAAgC,EAChC,SAAqB,EACrB,eAAwC,MAAM;IAE9C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAC,aAAa,EAAC,EAAE;QAC7C,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QAEpC,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAM;QACR,CAAC;QAED,0EAA0E;QAC1E,
|
|
1
|
+
{"version":3,"file":"test-session-cancel.js","sourceRoot":"","sources":["../../src/services/test-session-cancel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAUnD,MAAM,UAAU,gCAAgC,CAC9C,MAAgC,EAChC,SAAqB,EACrB,eAAwC,MAAM;IAE9C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAC,aAAa,EAAC,EAAE;QAC7C,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QAEpC,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,OAAM;QACR,CAAC;QAED,0EAA0E;QAC1E,gEAAgE;QAChE,4EAA4E;QAC5E,MAAM,YAAY,CAAC,iBAAiB,CAAC,EAAE,aAAa,EAAE,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/services/util.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChecklyConfig, PlaywrightSlimmedProp } from './checkly-config-loader.js';
|
|
2
2
|
export interface GitInformation {
|
|
3
|
-
|
|
3
|
+
/** Absent when the repository has no commits yet but a repo URL is known. */
|
|
4
|
+
commitId?: string;
|
|
4
5
|
repoUrl?: string | null;
|
|
5
6
|
branchName?: string | null;
|
|
6
7
|
commitOwner?: string | null;
|
|
@@ -28,6 +29,19 @@ export interface GitHubActionsInformation {
|
|
|
28
29
|
export interface CiInformation {
|
|
29
30
|
environment: string | null;
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Turns a git remote URL into a credential-free web URL, e.g.
|
|
34
|
+
* `git@github.com:acme/app.git` -> `https://github.com/acme/app`.
|
|
35
|
+
* Returns `undefined` for remotes that have no web URL (local paths, file://,
|
|
36
|
+
* SSH config aliases, SSH hosts with a different web path layout).
|
|
37
|
+
*/
|
|
38
|
+
export declare function normalizeGitRemoteUrl(remote: string): string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The web URL of the `origin` remote of the git repository at `cwd`, with
|
|
41
|
+
* credentials stripped. `undefined` when there is no repository, no origin,
|
|
42
|
+
* or git is not installed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getRepoUrlFromGit(cwd?: string): string | undefined;
|
|
31
45
|
export declare function findFilesRecursively(directory: string, ignoredPaths?: Array<string>): string[];
|
|
32
46
|
/**
|
|
33
47
|
* @param relPath the path to be converted
|
|
@@ -41,8 +55,9 @@ export declare function splitConfigFilePath(configFile?: string): {
|
|
|
41
55
|
export declare function isFileSync(path: string): boolean;
|
|
42
56
|
/**
|
|
43
57
|
* @param repoUrl default repoURL the user can set in their project config.
|
|
58
|
+
* @param cwd directory to read git information from.
|
|
44
59
|
*/
|
|
45
|
-
export declare function getGitInformation(repoUrl?: string): GitInformation | null;
|
|
60
|
+
export declare function getGitInformation(repoUrl?: string, cwd?: string): GitInformation | null;
|
|
46
61
|
/**
|
|
47
62
|
* The absolute path of the git repository root the CLI runs in, or
|
|
48
63
|
* `undefined` outside a repository. Kept separate from GitInformation, which
|
package/dist/services/util.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as path from 'path';
|
|
2
2
|
import * as fs from 'fs/promises';
|
|
3
3
|
import * as fsSync from 'fs';
|
|
4
|
+
import { execFileSync } from 'child_process';
|
|
4
5
|
import gitRepoInfo from 'git-repo-info';
|
|
5
6
|
import { parse } from 'dotenv';
|
|
6
7
|
import { glob } from 'glob';
|
|
@@ -14,6 +15,102 @@ function getGitHubRepositoryUrl() {
|
|
|
14
15
|
const serverUrl = process.env.CHECKLY_GITHUB_SERVER_URL ?? 'https://github.com';
|
|
15
16
|
return `${serverUrl.replace(/\/$/, '')}/${repository}`;
|
|
16
17
|
}
|
|
18
|
+
/** The repository URL from GitHub Actions' built-in env vars. */
|
|
19
|
+
function getGitHubActionsRepositoryUrl() {
|
|
20
|
+
const serverUrl = process.env.GITHUB_SERVER_URL;
|
|
21
|
+
const repository = process.env.GITHUB_REPOSITORY;
|
|
22
|
+
if (!serverUrl || !repository) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return `${serverUrl.replace(/\/$/, '')}/${repository}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Turns a git remote URL into a credential-free web URL, e.g.
|
|
29
|
+
* `git@github.com:acme/app.git` -> `https://github.com/acme/app`.
|
|
30
|
+
* Returns `undefined` for remotes that have no web URL (local paths, file://,
|
|
31
|
+
* SSH config aliases, SSH hosts with a different web path layout).
|
|
32
|
+
*/
|
|
33
|
+
export function normalizeGitRemoteUrl(remote) {
|
|
34
|
+
const trimmed = remote.trim();
|
|
35
|
+
if (!trimmed) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
let host;
|
|
39
|
+
let repoPath;
|
|
40
|
+
let protocol = 'https:';
|
|
41
|
+
let isSshRemote = true;
|
|
42
|
+
// scp-like syntax: [user@]host:path. A single-letter host is a Windows drive.
|
|
43
|
+
const scpLike = trimmed.match(/^(?:[^@/\s]+@)?([^:/\s]{2,}):(?!\/\/)(.+)$/);
|
|
44
|
+
if (scpLike) {
|
|
45
|
+
host = scpLike[1];
|
|
46
|
+
repoPath = scpLike[2];
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
let url;
|
|
50
|
+
try {
|
|
51
|
+
url = new URL(trimmed);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
if (url.protocol === 'https:' || url.protocol === 'http:') {
|
|
57
|
+
// Keep the port: it is part of the web address. Credentials are dropped.
|
|
58
|
+
protocol = url.protocol;
|
|
59
|
+
host = url.host;
|
|
60
|
+
isSshRemote = false;
|
|
61
|
+
}
|
|
62
|
+
else if (url.protocol === 'ssh:' || url.protocol === 'git+ssh:' || url.protocol === 'git:') {
|
|
63
|
+
// SSH and git-daemon ports don't carry over to the web URL.
|
|
64
|
+
host = url.hostname;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
repoPath = url.pathname;
|
|
70
|
+
}
|
|
71
|
+
repoPath = repoPath
|
|
72
|
+
.replace(/^\/+/, '')
|
|
73
|
+
.replace(/\/+$/, '')
|
|
74
|
+
.replace(/\.git$/, '')
|
|
75
|
+
.replace(/\/+$/, '');
|
|
76
|
+
if (!host || !repoPath) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
if (isSshRemote && !isWebHostForSshRemote(host)) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
return `${protocol}//${host}/${repoPath}`;
|
|
83
|
+
}
|
|
84
|
+
// SSH hosts whose repository paths don't map onto a web URL of the same shape.
|
|
85
|
+
const NON_WEB_SSH_HOSTS = new Set(['ssh.dev.azure.com', 'vs-ssh.visualstudio.com']);
|
|
86
|
+
/**
|
|
87
|
+
* Whether the host of an SSH remote (converted to https) is also a web host.
|
|
88
|
+
* A host without a dot is an SSH config alias (e.g. `github-work`), not a
|
|
89
|
+
* resolvable web address.
|
|
90
|
+
*/
|
|
91
|
+
function isWebHostForSshRemote(host) {
|
|
92
|
+
const hostname = host.toLowerCase();
|
|
93
|
+
return hostname.includes('.') && !NON_WEB_SSH_HOSTS.has(hostname);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The web URL of the `origin` remote of the git repository at `cwd`, with
|
|
97
|
+
* credentials stripped. `undefined` when there is no repository, no origin,
|
|
98
|
+
* or git is not installed.
|
|
99
|
+
*/
|
|
100
|
+
export function getRepoUrlFromGit(cwd = process.cwd()) {
|
|
101
|
+
let remote;
|
|
102
|
+
try {
|
|
103
|
+
remote = execFileSync('git', ['config', '--get', 'remote.origin.url'], {
|
|
104
|
+
cwd,
|
|
105
|
+
encoding: 'utf8',
|
|
106
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
return normalizeGitRemoteUrl(remote);
|
|
113
|
+
}
|
|
17
114
|
function isGitHubReportingEnabled() {
|
|
18
115
|
const value = (process.env.CHECKLY_GITHUB_REPORT ?? '').trim().toLowerCase();
|
|
19
116
|
return value === 'true' || value === '1';
|
|
@@ -82,23 +179,33 @@ export function isFileSync(path) {
|
|
|
82
179
|
}
|
|
83
180
|
/**
|
|
84
181
|
* @param repoUrl default repoURL the user can set in their project config.
|
|
182
|
+
* @param cwd directory to read git information from.
|
|
85
183
|
*/
|
|
86
|
-
export function getGitInformation(repoUrl) {
|
|
87
|
-
const repositoryInfo = gitRepoInfo();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
184
|
+
export function getGitInformation(repoUrl, cwd = process.cwd()) {
|
|
185
|
+
const repositoryInfo = gitRepoInfo(cwd);
|
|
186
|
+
const commitId = process.env.CHECKLY_REPO_SHA
|
|
187
|
+
?? process.env.CHECKLY_TEST_REPO_SHA
|
|
188
|
+
?? process.env.CHECKLY_GITHUB_SHA
|
|
189
|
+
?? repositoryInfo.sha
|
|
190
|
+
?? undefined;
|
|
191
|
+
// Declared values first; the git remote is only a last resort. Callers must
|
|
192
|
+
// not copy a derived URL into project.repoUrl: the backend only lets it fill
|
|
193
|
+
// a project that has no URL yet.
|
|
194
|
+
const resolvedRepoUrl = process.env.CHECKLY_REPO_URL
|
|
195
|
+
?? process.env.CHECKLY_TEST_REPO_URL
|
|
196
|
+
?? repoUrl
|
|
197
|
+
?? getGitHubRepositoryUrl()
|
|
198
|
+
?? getGitHubActionsRepositoryUrl()
|
|
199
|
+
?? getRepoUrlFromGit(cwd);
|
|
200
|
+
// A repository without commits still has a URL worth sending.
|
|
201
|
+
if (!commitId && !resolvedRepoUrl) {
|
|
92
202
|
return null;
|
|
93
203
|
}
|
|
94
204
|
// safe way to remove the email address
|
|
95
205
|
const committer = (repositoryInfo.committer?.match(/([^<]+)/) || [])[1]?.trim();
|
|
96
206
|
const gitInformation = {
|
|
97
|
-
commitId:
|
|
98
|
-
|
|
99
|
-
?? process.env.CHECKLY_GITHUB_SHA
|
|
100
|
-
?? repositoryInfo.sha,
|
|
101
|
-
repoUrl: process.env.CHECKLY_REPO_URL ?? process.env.CHECKLY_TEST_REPO_URL ?? repoUrl ?? getGitHubRepositoryUrl(),
|
|
207
|
+
...(commitId ? { commitId } : {}),
|
|
208
|
+
repoUrl: resolvedRepoUrl,
|
|
102
209
|
branchName: process.env.CHECKLY_REPO_BRANCH ?? process.env.CHECKLY_TEST_REPO_BRANCH ?? repositoryInfo.branch,
|
|
103
210
|
commitOwner: process.env.CHECKLY_REPO_COMMIT_OWNER ?? process.env.CHECKLY_TEST_REPO_COMMIT_OWNER ?? committer,
|
|
104
211
|
commitMessage: process.env.CHECKLY_REPO_COMMIT_MESSAGE
|