@speedkit/cli 4.50.5 → 4.51.0-run-control.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/README.md +1369 -10
- package/dist/base/run-control-command.d.ts +15 -0
- package/dist/base/run-control-command.js +20 -0
- package/dist/build-info.json +6 -0
- package/dist/commands/diff.d.ts +6 -1
- package/dist/commands/diff.js +9 -3
- package/dist/commands/onboarding/browser/click.d.ts +75 -0
- package/dist/commands/onboarding/browser/click.js +19 -0
- package/dist/commands/onboarding/browser/emulate.d.ts +93 -0
- package/dist/commands/onboarding/browser/emulate.js +23 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +67 -0
- package/dist/commands/onboarding/browser/navigate.js +18 -0
- package/dist/commands/onboarding/browser/panel.d.ts +63 -0
- package/dist/commands/onboarding/browser/panel.js +12 -0
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +63 -0
- package/dist/commands/onboarding/browser/reinstall-sw.js +14 -0
- package/dist/commands/onboarding/browser/reset.d.ts +71 -0
- package/dist/commands/onboarding/browser/reset.js +18 -0
- package/dist/commands/onboarding/browser/screenshot.d.ts +77 -0
- package/dist/commands/onboarding/browser/screenshot.js +19 -0
- package/dist/commands/onboarding/browser/state.d.ts +63 -0
- package/dist/commands/onboarding/browser/state.js +12 -0
- package/dist/commands/onboarding/browser/tabs.d.ts +58 -0
- package/dist/commands/onboarding/browser/tabs.js +16 -0
- package/dist/commands/onboarding/cache/clear.d.ts +58 -0
- package/dist/commands/onboarding/cache/clear.js +12 -0
- package/dist/commands/onboarding/cache/errors.d.ts +58 -0
- package/dist/commands/onboarding/cache/errors.js +12 -0
- package/dist/commands/onboarding/cache/evict.d.ts +62 -0
- package/dist/commands/onboarding/cache/evict.js +15 -0
- package/dist/commands/onboarding/cache/get.d.ts +85 -0
- package/dist/commands/onboarding/cache/get.js +17 -0
- package/dist/commands/onboarding/cache/list.d.ts +58 -0
- package/dist/commands/onboarding/cache/list.js +15 -0
- package/dist/commands/onboarding/cache/prewarm.d.ts +73 -0
- package/dist/commands/onboarding/cache/prewarm.js +20 -0
- package/dist/commands/onboarding/cache/refresh.d.ts +62 -0
- package/dist/commands/onboarding/cache/refresh.js +18 -0
- package/dist/commands/onboarding/cdp.d.ts +81 -0
- package/dist/commands/onboarding/cdp.js +18 -0
- package/dist/commands/onboarding/debug/arm.d.ts +77 -0
- package/dist/commands/onboarding/debug/arm.js +18 -0
- package/dist/commands/onboarding/debug/await.d.ts +71 -0
- package/dist/commands/onboarding/debug/await.js +18 -0
- package/dist/commands/onboarding/debug/disarm.d.ts +63 -0
- package/dist/commands/onboarding/debug/disarm.js +12 -0
- package/dist/commands/onboarding/debug/eval.d.ts +75 -0
- package/dist/commands/onboarding/debug/eval.js +16 -0
- package/dist/commands/onboarding/debug/release.d.ts +63 -0
- package/dist/commands/onboarding/debug/release.js +12 -0
- package/dist/commands/onboarding/debug/resume.d.ts +63 -0
- package/dist/commands/onboarding/debug/resume.js +12 -0
- package/dist/commands/onboarding/debug/status.d.ts +63 -0
- package/dist/commands/onboarding/debug/status.js +12 -0
- package/dist/commands/onboarding/debug/step.d.ts +67 -0
- package/dist/commands/onboarding/debug/step.js +15 -0
- package/dist/commands/onboarding/files/list.d.ts +58 -0
- package/dist/commands/onboarding/files/list.js +12 -0
- package/dist/commands/onboarding/files/read.d.ts +73 -0
- package/dist/commands/onboarding/files/read.js +16 -0
- package/dist/commands/onboarding/files/rebuild.d.ts +63 -0
- package/dist/commands/onboarding/files/rebuild.js +18 -0
- package/dist/commands/onboarding/files/validate.d.ts +58 -0
- package/dist/commands/onboarding/files/validate.js +12 -0
- package/dist/commands/onboarding/fouc.d.ts +77 -0
- package/dist/commands/onboarding/fouc.js +16 -0
- package/dist/commands/onboarding/inject/add.d.ts +89 -0
- package/dist/commands/onboarding/inject/add.js +17 -0
- package/dist/commands/onboarding/inject/clear.d.ts +63 -0
- package/dist/commands/onboarding/inject/clear.js +12 -0
- package/dist/commands/onboarding/inject/list.d.ts +63 -0
- package/dist/commands/onboarding/inject/list.js +12 -0
- package/dist/commands/onboarding/inject/read.d.ts +75 -0
- package/dist/commands/onboarding/inject/read.js +18 -0
- package/dist/commands/onboarding/inject/recipes.d.ts +63 -0
- package/dist/commands/onboarding/inject/recipes.js +12 -0
- package/dist/commands/onboarding/inject/remove.d.ts +67 -0
- package/dist/commands/onboarding/inject/remove.js +15 -0
- package/dist/commands/onboarding/list.d.ts +13 -0
- package/dist/commands/onboarding/list.js +12 -0
- package/dist/commands/onboarding/logs.d.ts +41 -0
- package/dist/commands/onboarding/logs.js +256 -0
- package/dist/commands/onboarding/navwalk.d.ts +95 -0
- package/dist/commands/onboarding/navwalk.js +19 -0
- package/dist/commands/onboarding/response.d.ts +67 -0
- package/dist/commands/onboarding/response.js +18 -0
- package/dist/commands/onboarding/rum/beacons.d.ts +75 -0
- package/dist/commands/onboarding/rum/beacons.js +16 -0
- package/dist/commands/onboarding/rum/get.d.ts +77 -0
- package/dist/commands/onboarding/rum/get.js +18 -0
- package/dist/commands/onboarding/rum/key.d.ts +67 -0
- package/dist/commands/onboarding/rum/key.js +13 -0
- package/dist/commands/onboarding/rum/previous.d.ts +63 -0
- package/dist/commands/onboarding/rum/previous.js +12 -0
- package/dist/commands/onboarding/status.d.ts +13 -0
- package/dist/commands/onboarding/status.js +17 -0
- package/dist/commands/onboarding/todo.d.ts +58 -0
- package/dist/commands/onboarding/todo.js +12 -0
- package/dist/commands/onboarding/viewport.d.ts +101 -0
- package/dist/commands/onboarding/viewport.js +18 -0
- package/dist/commands/onboarding/watch.d.ts +93 -0
- package/dist/commands/onboarding/watch.js +16 -0
- package/dist/commands/onboarding.d.ts +26 -0
- package/dist/commands/onboarding.js +220 -3
- package/dist/commands/origin-request.d.ts +4 -0
- package/dist/commands/origin-request.js +4 -0
- package/dist/commands/spec/onboarding.spec.d.ts +1 -0
- package/dist/commands/spec/onboarding.spec.js +127 -0
- package/dist/services/cli/build-info.d.ts +33 -0
- package/dist/services/cli/build-info.js +63 -0
- package/dist/services/cli/cli-environment-factory.d.ts +3 -0
- package/dist/services/cli/cli-environment-factory.js +1 -0
- package/dist/services/cli/cli-service-build-context.d.ts +3 -0
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +29 -10
- package/dist/services/cli/cli-service.d.ts +60 -11
- package/dist/services/cli/cli-service.js +196 -32
- package/dist/services/cli/index.d.ts +2 -0
- package/dist/services/cli/index.js +2 -0
- package/dist/services/cli/sink.d.ts +47 -0
- package/dist/services/cli/sink.js +31 -0
- package/dist/services/cli/spec/build-identity.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-identity.spec.js +85 -0
- package/dist/services/cli/spec/build-info.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-info.spec.js +10 -0
- package/dist/services/cli/spec/cli-service-log.spec.d.ts +1 -0
- package/dist/services/cli/spec/cli-service-log.spec.js +133 -0
- package/dist/services/cli/spec/cli-service.spec.js +113 -50
- package/dist/services/cli/spec/memory-cli.d.ts +9 -0
- package/dist/services/cli/spec/memory-cli.js +9 -0
- package/dist/services/diff/config-at-ref.d.ts +20 -0
- package/dist/services/diff/config-at-ref.js +33 -0
- package/dist/services/diff/diff-service-build-context.d.ts +8 -0
- package/dist/services/diff/diff-service-build-context.js +40 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +48 -20
- package/dist/services/diff/diff-service.d.ts +11 -0
- package/dist/services/diff/diff-service.js +37 -11
- package/dist/services/diff/page-source.d.ts +12 -0
- package/dist/services/diff/page-source.js +16 -11
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +3 -2
- package/dist/services/diff/sinks/tool-diff-sink.js +3 -2
- package/dist/services/diff/spec/config-at-ref.spec.d.ts +1 -0
- package/dist/services/diff/spec/config-at-ref.spec.js +46 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +19 -0
- package/dist/services/diff/spec/diff-service.spec.js +95 -0
- package/dist/services/git/git-repository.d.ts +2 -0
- package/dist/services/git/git-repository.js +6 -0
- package/dist/services/integration-api/customer-config-flags.js +1 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +17 -1
- package/dist/services/onboarding/browser/baqend-response.js +23 -0
- package/dist/services/onboarding/browser/console-log.d.ts +9 -0
- package/dist/services/onboarding/browser/console-log.js +27 -0
- package/dist/services/onboarding/browser/executable/executable-validator.js +4 -2
- package/dist/services/onboarding/browser/extension/extension-bridge.js +5 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +17 -8
- package/dist/services/onboarding/browser/extension/extension-validator.js +9 -4
- package/dist/services/onboarding/control/body-inspect.d.ts +24 -0
- package/dist/services/onboarding/control/body-inspect.js +106 -0
- package/dist/services/onboarding/control/browser-session.d.ts +521 -0
- package/dist/services/onboarding/control/browser-session.js +1273 -0
- package/dist/services/onboarding/control/config-validation.d.ts +17 -0
- package/dist/services/onboarding/control/config-validation.js +46 -0
- package/dist/services/onboarding/control/control-protocol.d.ts +1390 -0
- package/dist/services/onboarding/control/control-protocol.js +69 -0
- package/dist/services/onboarding/control/control-server.d.ts +284 -0
- package/dist/services/onboarding/control/control-server.js +1609 -0
- package/dist/services/onboarding/control/debug-session.d.ts +190 -0
- package/dist/services/onboarding/control/debug-session.js +801 -0
- package/dist/services/onboarding/control/fouc.d.ts +23 -0
- package/dist/services/onboarding/control/fouc.js +151 -0
- package/dist/services/onboarding/control/index.d.ts +4 -0
- package/dist/services/onboarding/control/index.js +4 -0
- package/dist/services/onboarding/control/navwalk.d.ts +65 -0
- package/dist/services/onboarding/control/navwalk.js +248 -0
- package/dist/services/onboarding/control/preload-registry.d.ts +150 -0
- package/dist/services/onboarding/control/preload-registry.js +829 -0
- package/dist/services/onboarding/control/response-explainer.d.ts +24 -0
- package/dist/services/onboarding/control/response-explainer.js +257 -0
- package/dist/services/onboarding/control/rum.d.ts +8 -0
- package/dist/services/onboarding/control/rum.js +220 -0
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +68 -0
- package/dist/services/onboarding/control/service-worker-tracker.js +119 -0
- package/dist/services/onboarding/control/viewport.d.ts +45 -0
- package/dist/services/onboarding/control/viewport.js +344 -0
- package/dist/services/onboarding/control/watch.d.ts +26 -0
- package/dist/services/onboarding/control/watch.js +149 -0
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +3 -1
- package/dist/services/onboarding/dashboard/index.js +7 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +24 -5
- package/dist/services/onboarding/fetch-event-handler.js +94 -32
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +11 -2
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +30 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +13 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +28 -1
- package/dist/services/onboarding/file-events/file-watcher.d.ts +42 -1
- package/dist/services/onboarding/file-events/file-watcher.js +117 -12
- package/dist/services/onboarding/onboarding-model.d.ts +30 -0
- package/dist/services/onboarding/onboarding-model.js +10 -0
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +6 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +131 -17
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +135 -22
- package/dist/services/onboarding/request-cache/asset-key.d.ts +61 -0
- package/dist/services/onboarding/request-cache/asset-key.js +115 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +62 -5
- package/dist/services/onboarding/request-cache/cache.js +128 -17
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +526 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +338 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +693 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +66 -0
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/fouc.spec.js +167 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.js +222 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +432 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +324 -0
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/rum.spec.js +222 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +193 -0
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/viewport.spec.js +200 -0
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/watch.spec.js +172 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +202 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +41 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +37 -0
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +107 -0
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/todo-collector.spec.js +136 -0
- package/dist/services/onboarding/todo-collector.d.ts +7 -2
- package/dist/services/onboarding/todo-collector.js +49 -12
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +34 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +82 -27
- package/dist/services/origin-request/asset-variations.d.ts +14 -0
- package/dist/services/origin-request/asset-variations.js +11 -4
- package/dist/services/origin-request/origin-fetcher.d.ts +7 -0
- package/dist/services/origin-request/origin-fetcher.js +43 -5
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +17 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +8 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +0 -5
- package/dist/services/origin-request/origin-request-service-factory.js +2 -30
- package/dist/services/origin-request/origin-request-service.d.ts +121 -6
- package/dist/services/origin-request/origin-request-service.js +273 -49
- package/dist/services/origin-request/runtime-config-source.js +9 -4
- package/dist/services/origin-request/spec/asset-variations.spec.js +20 -0
- package/dist/services/origin-request/spec/origin-request-service.spec.js +329 -6
- package/dist/services/query-builder/rules/rule-match.d.ts +35 -0
- package/dist/services/query-builder/rules/rule-match.js +70 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +1 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +121 -0
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +541 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +78 -0
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +5 -0
- package/dist/services/run-control/browser/run-browser-service-factory.js +7 -0
- package/dist/services/run-control/browser/run-browser-service.d.ts +64 -0
- package/dist/services/run-control/browser/run-browser-service.js +199 -0
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +349 -0
- package/dist/services/run-control/cache/run-cache-contexts.js +51 -0
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +6 -0
- package/dist/services/run-control/cache/run-cache-service-factory.js +12 -0
- package/dist/services/run-control/cache/run-cache-service.d.ts +35 -0
- package/dist/services/run-control/cache/run-cache-service.js +151 -0
- package/dist/services/run-control/control-client.d.ts +36 -0
- package/dist/services/run-control/control-client.js +147 -0
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +411 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +44 -0
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +5 -0
- package/dist/services/run-control/debug/run-debug-service-factory.js +7 -0
- package/dist/services/run-control/debug/run-debug-service.d.ts +38 -0
- package/dist/services/run-control/debug/run-debug-service.js +161 -0
- package/dist/services/run-control/files/run-files-contexts.d.ts +238 -0
- package/dist/services/run-control/files/run-files-contexts.js +26 -0
- package/dist/services/run-control/files/run-files-service-factory.d.ts +5 -0
- package/dist/services/run-control/files/run-files-service-factory.js +7 -0
- package/dist/services/run-control/files/run-files-service.d.ts +29 -0
- package/dist/services/run-control/files/run-files-service.js +120 -0
- package/dist/services/run-control/index.d.ts +32 -0
- package/dist/services/run-control/index.js +31 -0
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +319 -0
- package/dist/services/run-control/inject/run-inject-contexts.js +32 -0
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +5 -0
- package/dist/services/run-control/inject/run-inject-service-factory.js +7 -0
- package/dist/services/run-control/inject/run-inject-service.d.ts +31 -0
- package/dist/services/run-control/inject/run-inject-service.js +203 -0
- package/dist/services/run-control/live-run.d.ts +37 -0
- package/dist/services/run-control/live-run.js +56 -0
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +333 -0
- package/dist/services/run-control/probe/run-probe-contexts.js +73 -0
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +5 -0
- package/dist/services/run-control/probe/run-probe-service-factory.js +7 -0
- package/dist/services/run-control/probe/run-probe-service.d.ts +54 -0
- package/dist/services/run-control/probe/run-probe-service.js +193 -0
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +216 -0
- package/dist/services/run-control/rum/run-rum-contexts.js +34 -0
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +5 -0
- package/dist/services/run-control/rum/run-rum-service-factory.js +7 -0
- package/dist/services/run-control/rum/run-rum-service.d.ts +36 -0
- package/dist/services/run-control/rum/run-rum-service.js +122 -0
- package/dist/services/run-control/run-answer.d.ts +28 -0
- package/dist/services/run-control/run-answer.js +58 -0
- package/dist/services/run-control/run-control-context.d.ts +102 -0
- package/dist/services/run-control/run-control-context.js +36 -0
- package/dist/services/run-control/run-control-flags.d.ts +12 -0
- package/dist/services/run-control/run-control-flags.js +22 -0
- package/dist/services/run-control/run-control-model.d.ts +9 -0
- package/dist/services/run-control/run-control-model.js +1 -0
- package/dist/services/run-control/run-control-service-factory.d.ts +14 -0
- package/dist/services/run-control/run-control-service-factory.js +26 -0
- package/dist/services/run-control/session/run-session-contexts.d.ts +25 -0
- package/dist/services/run-control/session/run-session-contexts.js +20 -0
- package/dist/services/run-control/session/run-session-service-factory.d.ts +8 -0
- package/dist/services/run-control/session/run-session-service-factory.js +18 -0
- package/dist/services/run-control/session/run-session-service.d.ts +25 -0
- package/dist/services/run-control/session/run-session-service.js +95 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +327 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +454 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +113 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.js +234 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +224 -0
- package/dist/services/run-control/spec/live-run-fixture.d.ts +32 -0
- package/dist/services/run-control/spec/live-run-fixture.js +109 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +108 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +47 -0
- package/dist/services/run-control/spec/run-answer.spec.d.ts +1 -0
- package/dist/services/run-control/spec/run-answer.spec.js +57 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.js +101 -0
- package/dist/services/run-log/crash-mirror.d.ts +31 -0
- package/dist/services/run-log/crash-mirror.js +69 -0
- package/dist/services/run-log/index.d.ts +11 -0
- package/dist/services/run-log/index.js +11 -0
- package/dist/services/run-log/jsonl-appender.d.ts +46 -0
- package/dist/services/run-log/jsonl-appender.js +91 -0
- package/dist/services/run-log/log-event-model.d.ts +104 -0
- package/dist/services/run-log/log-event-model.js +56 -0
- package/dist/services/run-log/log-query-service-factory.d.ts +11 -0
- package/dist/services/run-log/log-query-service-factory.js +14 -0
- package/dist/services/run-log/log-query-service.d.ts +59 -0
- package/dist/services/run-log/log-query-service.js +111 -0
- package/dist/services/run-log/log-reader.d.ts +84 -0
- package/dist/services/run-log/log-reader.js +180 -0
- package/dist/services/run-log/log-summary.d.ts +72 -0
- package/dist/services/run-log/log-summary.js +208 -0
- package/dist/services/run-log/redaction.d.ts +34 -0
- package/dist/services/run-log/redaction.js +124 -0
- package/dist/services/run-log/request-log.d.ts +80 -0
- package/dist/services/run-log/request-log.js +69 -0
- package/dist/services/run-log/request-summary.d.ts +76 -0
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +61 -0
- package/dist/services/run-log/run-log.js +102 -0
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-query-service.spec.js +197 -0
- package/dist/services/run-log/spec/log-reader.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-reader.spec.js +109 -0
- package/dist/services/run-log/spec/log-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-summary.spec.js +153 -0
- package/dist/services/run-log/spec/redaction.spec.d.ts +1 -0
- package/dist/services/run-log/spec/redaction.spec.js +61 -0
- package/dist/services/run-log/spec/request-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-log.spec.js +101 -0
- package/dist/services/run-log/spec/request-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-summary.spec.js +171 -0
- package/dist/services/run-log/spec/run-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/run-log.spec.js +122 -0
- package/dist/services/run-registry/exit-classification.d.ts +39 -0
- package/dist/services/run-registry/exit-classification.js +42 -0
- package/dist/services/run-registry/index.d.ts +3 -0
- package/dist/services/run-registry/index.js +3 -0
- package/dist/services/run-registry/process-identity.d.ts +28 -0
- package/dist/services/run-registry/process-identity.js +80 -0
- package/dist/services/run-registry/run-registry-model.d.ts +128 -0
- package/dist/services/run-registry/run-registry-model.js +16 -0
- package/dist/services/run-registry/run-registry.d.ts +150 -0
- package/dist/services/run-registry/run-registry.js +409 -0
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/exit-classification.spec.js +82 -0
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/run-registry.spec.js +509 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3293 -272
- package/package.json +20 -2
|
@@ -12,6 +12,7 @@ import { assertCustomerOrigin } from "./customer-origin.js";
|
|
|
12
12
|
import { stderrLog } from "./diff-log.js";
|
|
13
13
|
import { variationPair, } from "./diff-service-build-context.js";
|
|
14
14
|
import { DiffService } from "./diff-service.js";
|
|
15
|
+
import { configAtRef } from "./config-at-ref.js";
|
|
15
16
|
import { PageSource } from "./page-source.js";
|
|
16
17
|
/**
|
|
17
18
|
* The variations a person can choose from: the device variations and the
|
|
@@ -47,8 +48,11 @@ export class DiffServiceFactory {
|
|
|
47
48
|
async build() {
|
|
48
49
|
const { environment } = this.context;
|
|
49
50
|
const chosenParameters = await this.withChosenParameters();
|
|
50
|
-
|
|
51
|
-
const
|
|
51
|
+
// JSON and a patch own stdout; the progress goes to stderr.
|
|
52
|
+
const ownsStdout = ["json", "patch"].includes(this.context.output);
|
|
53
|
+
const log = ownsStdout
|
|
54
|
+
? stderrLog(environment.cli)
|
|
55
|
+
: environment.cli;
|
|
52
56
|
const files = this.context.customerPath
|
|
53
57
|
? await this.getIntegrationFiles()
|
|
54
58
|
: undefined;
|
|
@@ -59,13 +63,30 @@ export class DiffServiceFactory {
|
|
|
59
63
|
for (const url of [pageUrl, against].filter(Boolean)) {
|
|
60
64
|
assertCustomerOrigin(url, customer.origins, this.context.customerPath);
|
|
61
65
|
}
|
|
62
|
-
applyOriginProxy(customer.chromeFlags,
|
|
66
|
+
applyOriginProxy(customer.chromeFlags, ownsStdout ? undefined : environment.cli);
|
|
63
67
|
}
|
|
64
68
|
const config = await this.loadRuntimeConfig(log, customer?.app);
|
|
65
69
|
if (!config) {
|
|
66
70
|
throw new ApplicationError("no runtime config to build the requests from");
|
|
67
71
|
}
|
|
68
72
|
const options = await this.withChosenVariations(chosenParameters, config.variations);
|
|
73
|
+
const fetcher = new OriginFetcher({
|
|
74
|
+
cli: log,
|
|
75
|
+
config,
|
|
76
|
+
host: this.context.host,
|
|
77
|
+
strict: true,
|
|
78
|
+
});
|
|
79
|
+
const ignore = this.context.ignore.map((pattern) => new RegExp(pattern, "g"));
|
|
80
|
+
const pages = new PageSource({
|
|
81
|
+
fetcher,
|
|
82
|
+
documentHandler: this.context.raw || !files
|
|
83
|
+
? undefined
|
|
84
|
+
: await this.buildDocumentHandler(files, this.context.customerPath),
|
|
85
|
+
ignore,
|
|
86
|
+
});
|
|
87
|
+
const base = this.context.base
|
|
88
|
+
? await this.buildBase(log, fetcher, ignore)
|
|
89
|
+
: undefined;
|
|
69
90
|
// Installed last, after everything that can fail: the service closes it.
|
|
70
91
|
const browserFetch = this.context.browserFetch
|
|
71
92
|
? installBrowserOriginFetch({ environment, logger: log, mode: "always" })
|
|
@@ -77,21 +98,28 @@ export class DiffServiceFactory {
|
|
|
77
98
|
options,
|
|
78
99
|
log,
|
|
79
100
|
browserFetch,
|
|
101
|
+
base,
|
|
80
102
|
engine: createDiffEngine(environment, this.context.output),
|
|
81
|
-
pages
|
|
82
|
-
fetcher: new OriginFetcher({
|
|
83
|
-
cli: log,
|
|
84
|
-
config,
|
|
85
|
-
host: this.context.host,
|
|
86
|
-
strict: true,
|
|
87
|
-
}),
|
|
88
|
-
documentHandler: this.context.raw || !files
|
|
89
|
-
? undefined
|
|
90
|
-
: await this.buildDocumentHandler(files),
|
|
91
|
-
ignore: this.context.ignore.map((pattern) => new RegExp(pattern, "g")),
|
|
92
|
-
}),
|
|
103
|
+
pages,
|
|
93
104
|
});
|
|
94
105
|
}
|
|
106
|
+
/** The pages rendered with the customer config at `--base`, from a checkout of it. */
|
|
107
|
+
async buildBase(log, fetcher, ignore) {
|
|
108
|
+
const checkout = await configAtRef(this.context.customerPath, this.context.base);
|
|
109
|
+
log.comment(`--base ${this.context.base}: the config at ${checkout.commit.slice(0, 8)}, where HEAD left it`);
|
|
110
|
+
try {
|
|
111
|
+
const files = await this.getIntegrationFiles(checkout.customerPath);
|
|
112
|
+
const documentHandler = await this.buildDocumentHandler(files, checkout.customerPath);
|
|
113
|
+
return {
|
|
114
|
+
pages: new PageSource({ fetcher, documentHandler, ignore }),
|
|
115
|
+
remove: checkout.remove,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
await checkout.remove();
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
95
123
|
/**
|
|
96
124
|
* The options, with the parameters an empty `--param` asked for added to
|
|
97
125
|
* the ones removed. Asked first, before anything is loaded or fetched.
|
|
@@ -123,7 +151,7 @@ export class DiffServiceFactory {
|
|
|
123
151
|
const chosen = await this.context.environment.cli.multiSelect("Which variations should be compared? One is compared against desktop", variationChoices(variations), (picked) => (picked.length === 1 && picked[0] !== DEFAULT_TYPE) ||
|
|
124
152
|
picked.length === 2 ||
|
|
125
153
|
"Choose one variation to compare against desktop, or two to compare with each other.");
|
|
126
|
-
// A quiet CLI (--output json) does not ask, and answers with no choice.
|
|
154
|
+
// A quiet CLI (--output json or patch) does not ask, and answers with no choice.
|
|
127
155
|
if (chosen.length === 0) {
|
|
128
156
|
throw new ApplicationError("No variation chosen, so nothing to compare.", ["Name them: --variations mobile, or --variations tablet,mobile"]);
|
|
129
157
|
}
|
|
@@ -156,20 +184,20 @@ export class DiffServiceFactory {
|
|
|
156
184
|
}).load(this.context.variationsFile);
|
|
157
185
|
}
|
|
158
186
|
/** The customer's files, with the released document handler unless it brings its own. */
|
|
159
|
-
async getIntegrationFiles() {
|
|
187
|
+
async getIntegrationFiles(customerPath = this.context.customerPath) {
|
|
160
188
|
return new IntegrationApiFactory(new IntegrationApiServiceBuildContext({
|
|
161
189
|
environment: this.context.environment,
|
|
162
|
-
basePath:
|
|
190
|
+
basePath: customerPath,
|
|
163
191
|
configName: this.context.configName,
|
|
164
192
|
whitelist: [],
|
|
165
193
|
}))
|
|
166
194
|
.buildService()
|
|
167
195
|
.run(this.context.raw ? [] : documentHandlerRuntimeFiles());
|
|
168
196
|
}
|
|
169
|
-
async buildDocumentHandler(files) {
|
|
197
|
+
async buildDocumentHandler(files, customerPath) {
|
|
170
198
|
return new DocumentHandlerRuntimeServiceFactory(new DocumentHandlerRuntimeServiceBuildContext({
|
|
171
199
|
environment: this.context.environment,
|
|
172
|
-
customerPath
|
|
200
|
+
customerPath,
|
|
173
201
|
configName: this.context.configName,
|
|
174
202
|
verboseLevel: false,
|
|
175
203
|
}), files).buildDocumentHandlerServer();
|
|
@@ -11,6 +11,11 @@ export interface DiffServiceDeps {
|
|
|
11
11
|
readonly pages: PageSource;
|
|
12
12
|
/** The headless Chrome pages are fetched through; closed when the run ends. */
|
|
13
13
|
readonly browserFetch?: BrowserOriginFetchHandle;
|
|
14
|
+
/** With `--base`: the pages rendered with the config at that ref, and how to remove its checkout. */
|
|
15
|
+
readonly base?: {
|
|
16
|
+
readonly pages: PageSource;
|
|
17
|
+
remove(): Promise<void>;
|
|
18
|
+
};
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
21
|
* `sk diff`: compares one page, as Speed Kit's server would request and the
|
|
@@ -60,6 +65,12 @@ export declare class DiffService {
|
|
|
60
65
|
*/
|
|
61
66
|
run(): Promise<ComparisonOutcome>;
|
|
62
67
|
private check;
|
|
68
|
+
/**
|
|
69
|
+
* One origin page, rendered with the config at `--base` and with the
|
|
70
|
+
* working tree: only what the config change does. The page is requested
|
|
71
|
+
* once, or read from `--html`; an origin failure ends the run.
|
|
72
|
+
*/
|
|
73
|
+
private checkBase;
|
|
63
74
|
/** The page against another page, both in one variation. */
|
|
64
75
|
private checkAgainst;
|
|
65
76
|
private checkVariations;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
1
2
|
import { withoutNoise } from "./noise-baseline.js";
|
|
2
3
|
import ApplicationError from "../error-handling/error/application-error.js";
|
|
3
4
|
import { PageSideFailure } from "./side-failure.js";
|
|
4
5
|
function isFailed(side) {
|
|
5
6
|
return side !== undefined && "failure" in side;
|
|
6
7
|
}
|
|
8
|
+
/** The side a failure Speed Kit's server would also have leaves; any other error ends the run. */
|
|
9
|
+
function failedPage(error, label, url, variation) {
|
|
10
|
+
if (!(error instanceof PageSideFailure))
|
|
11
|
+
throw error;
|
|
12
|
+
return { label, failure: error.failure, details: { url, variation }, error };
|
|
13
|
+
}
|
|
7
14
|
/** The failed side as a sink reports it, without the error object. */
|
|
8
15
|
function withoutError({ error: _error, ...side }) {
|
|
9
16
|
return side;
|
|
@@ -81,11 +88,16 @@ export class DiffService {
|
|
|
81
88
|
finally {
|
|
82
89
|
this.deps.engine.finish();
|
|
83
90
|
await this.deps.browserFetch?.close();
|
|
91
|
+
await this.deps.base?.remove();
|
|
84
92
|
}
|
|
85
93
|
return (OUTCOME_RANK.find((outcome) => this.outcomes.has(outcome)) ?? "equal");
|
|
86
94
|
}
|
|
87
95
|
async check() {
|
|
88
96
|
const { against, variation, variations, params } = this.deps.options;
|
|
97
|
+
if (this.deps.base) {
|
|
98
|
+
await this.checkBase(this.deps.base.pages, variation);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
89
101
|
if (against) {
|
|
90
102
|
await this.checkAgainst(against, variation);
|
|
91
103
|
return;
|
|
@@ -102,6 +114,27 @@ export class DiffService {
|
|
|
102
114
|
await this.checkParameters(each);
|
|
103
115
|
}
|
|
104
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* One origin page, rendered with the config at `--base` and with the
|
|
119
|
+
* working tree: only what the config change does. The page is requested
|
|
120
|
+
* once, or read from `--html`; an origin failure ends the run.
|
|
121
|
+
*/
|
|
122
|
+
async checkBase(basePages, variation) {
|
|
123
|
+
const { pageUrl, base, html } = this.deps.options;
|
|
124
|
+
const page = html === undefined
|
|
125
|
+
? await this.deps.pages.origin(pageUrl, variation)
|
|
126
|
+
: { html: await readFile(html, "utf8") };
|
|
127
|
+
const render = (pages, label) => pages
|
|
128
|
+
.fromHtml(page.html, pageUrl, variation, {
|
|
129
|
+
label,
|
|
130
|
+
contentType: page.contentType,
|
|
131
|
+
})
|
|
132
|
+
.catch((error) => failedPage(error, label, pageUrl, variation));
|
|
133
|
+
const before = await render(basePages, `config at ${base}`);
|
|
134
|
+
const after = await render(this.deps.pages, "working tree");
|
|
135
|
+
this.announce(`Checking the working tree against ${base} (${variation})...`, [`- url: ${pageUrl}`, ...(html === undefined ? [] : [`- html: ${html}`])]);
|
|
136
|
+
await this.compare(before, after);
|
|
137
|
+
}
|
|
105
138
|
/** The page against another page, both in one variation. */
|
|
106
139
|
async checkAgainst(against, variation) {
|
|
107
140
|
const { pageUrl } = this.deps.options;
|
|
@@ -237,7 +270,9 @@ export class DiffService {
|
|
|
237
270
|
reportFailure(left, right) {
|
|
238
271
|
const { log, engine } = this.deps;
|
|
239
272
|
const failed = [left, right].filter(isFailed);
|
|
240
|
-
|
|
273
|
+
// With --base, any rendering failure is the config change's verdict.
|
|
274
|
+
const verdict = (error) => this.deps.base ? error.failure.kind !== "origin" : error.isAbort;
|
|
275
|
+
const outcome = failed.every((side) => verdict(side.error))
|
|
241
276
|
? "uncacheable"
|
|
242
277
|
: "failed";
|
|
243
278
|
for (const { error } of failed) {
|
|
@@ -281,16 +316,7 @@ export class DiffService {
|
|
|
281
316
|
if (!side) {
|
|
282
317
|
side = this.deps.pages
|
|
283
318
|
.fetch(url, variation, label, { baseline: this.deps.options.baseline })
|
|
284
|
-
.catch((error) =>
|
|
285
|
-
if (!(error instanceof PageSideFailure))
|
|
286
|
-
throw error;
|
|
287
|
-
return {
|
|
288
|
-
label,
|
|
289
|
-
failure: error.failure,
|
|
290
|
-
details: { url, variation },
|
|
291
|
-
error,
|
|
292
|
-
};
|
|
293
|
-
});
|
|
319
|
+
.catch((error) => failedPage(error, label, url, variation));
|
|
294
320
|
this.sides.set(key, side);
|
|
295
321
|
}
|
|
296
322
|
return side;
|
|
@@ -19,6 +19,13 @@ export interface PageSourceOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
readonly baseline?: boolean;
|
|
21
21
|
}
|
|
22
|
+
/** A page as the origin answered it. */
|
|
23
|
+
export interface OriginPage {
|
|
24
|
+
readonly html: string;
|
|
25
|
+
readonly contentType?: string;
|
|
26
|
+
/** Where the request went and what it answered, for a sink that reports it. */
|
|
27
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
28
|
+
}
|
|
22
29
|
/**
|
|
23
30
|
* One side of a page diff: the page fetched from origin as Speed Kit's server
|
|
24
31
|
* requests it for a variation, rendered by the customer's local
|
|
@@ -29,6 +36,11 @@ export declare class PageSource {
|
|
|
29
36
|
constructor(deps: PageSourceDeps);
|
|
30
37
|
fetch(url: string, variation: string, label: string, options?: PageSourceOptions): Promise<BaselinedSide>;
|
|
31
38
|
private fetchOnce;
|
|
39
|
+
/**
|
|
40
|
+
* The page as the origin answers Speed Kit's server, before the
|
|
41
|
+
* documentHandler renders it.
|
|
42
|
+
*/
|
|
43
|
+
origin(url: string, variation: string): Promise<OriginPage>;
|
|
32
44
|
/**
|
|
33
45
|
* A side from HTML the caller already has, such as the page a browser
|
|
34
46
|
* shows: rendered and reduced the same way a fetched page is.
|
|
@@ -23,6 +23,19 @@ export class PageSource {
|
|
|
23
23
|
return { ...side, baseline: baselineOf(side.content, again.content) };
|
|
24
24
|
}
|
|
25
25
|
async fetchOnce(url, variation, label, options) {
|
|
26
|
+
const page = await this.origin(url, variation);
|
|
27
|
+
const side = await this.fromHtml(page.html, url, variation, {
|
|
28
|
+
...options,
|
|
29
|
+
label,
|
|
30
|
+
contentType: page.contentType,
|
|
31
|
+
});
|
|
32
|
+
return { ...side, details: { ...side.details, ...page.details } };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The page as the origin answers Speed Kit's server, before the
|
|
36
|
+
* documentHandler renders it.
|
|
37
|
+
*/
|
|
38
|
+
async origin(url, variation) {
|
|
26
39
|
const fetched = await this.deps.fetcher.fetch(url, variation);
|
|
27
40
|
if (!fetched) {
|
|
28
41
|
throw new ApplicationError(`${url} (${variation}) could not be fetched.`);
|
|
@@ -38,18 +51,10 @@ export class PageSource {
|
|
|
38
51
|
failure: originFailure(response.status, response.statusText),
|
|
39
52
|
});
|
|
40
53
|
}
|
|
41
|
-
const side = await this.fromHtml(await response.text(), url, variation, {
|
|
42
|
-
...options,
|
|
43
|
-
label,
|
|
44
|
-
contentType: response.headers.get("content-type") ?? undefined,
|
|
45
|
-
});
|
|
46
54
|
return {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
requestUrl: fetched.url,
|
|
51
|
-
status: response.status,
|
|
52
|
-
},
|
|
55
|
+
html: await response.text(),
|
|
56
|
+
contentType: response.headers.get("content-type") ?? undefined,
|
|
57
|
+
details: { requestUrl: fetched.url, status: response.status },
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
60
|
/**
|
|
@@ -11,8 +11,9 @@ export interface ToolDiffSinkDeps {
|
|
|
11
11
|
* IntelliJ IDEA when none is configured.
|
|
12
12
|
*
|
|
13
13
|
* Both sides are written to files under the CLI's cache directory, which
|
|
14
|
-
* outlive the command
|
|
15
|
-
*
|
|
14
|
+
* outlive the command. The right side is read back once the command returns,
|
|
15
|
+
* so an edit made in the tool reaches the caller only when the command blocks
|
|
16
|
+
* until the diff is closed: `idea diff` does, VS Code needs `--wait`.
|
|
16
17
|
*/
|
|
17
18
|
export declare class ToolDiffSink implements DiffSink {
|
|
18
19
|
private readonly deps;
|
|
@@ -18,8 +18,9 @@ function fileName(label) {
|
|
|
18
18
|
* IntelliJ IDEA when none is configured.
|
|
19
19
|
*
|
|
20
20
|
* Both sides are written to files under the CLI's cache directory, which
|
|
21
|
-
* outlive the command
|
|
22
|
-
*
|
|
21
|
+
* outlive the command. The right side is read back once the command returns,
|
|
22
|
+
* so an edit made in the tool reaches the caller only when the command blocks
|
|
23
|
+
* until the diff is closed: `idea diff` does, VS Code needs `--wait`.
|
|
23
24
|
*/
|
|
24
25
|
export class ToolDiffSink {
|
|
25
26
|
deps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { expect } from "chai";
|
|
4
|
+
import { describe, it } from "mocha";
|
|
5
|
+
import { GitRepository } from "../../git/index.js";
|
|
6
|
+
import { configAtRef } from "../config-at-ref.js";
|
|
7
|
+
/** A repository whose merge base with any ref is `fork`, and holds the files in `files`. */
|
|
8
|
+
function repositoryWith(files, seen = []) {
|
|
9
|
+
return new GitRepository("/repo", (args) => {
|
|
10
|
+
seen.push(args);
|
|
11
|
+
if (args[0] === "merge-base")
|
|
12
|
+
return "f0f0f0f0f0\n";
|
|
13
|
+
if (args[0] === "ls-tree")
|
|
14
|
+
return Object.keys(files).join("\n");
|
|
15
|
+
if (args[0] === "show")
|
|
16
|
+
return files[args[1].split(":")[1]];
|
|
17
|
+
throw new Error(`unexpected git ${args.join(" ")}`);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
describe("configAtRef", () => {
|
|
21
|
+
it("writes the customer directory as the ref holds it, and removes it", async () => {
|
|
22
|
+
const checkout = await configAtRef("/repo/customers/shop", "origin/main", repositoryWith({
|
|
23
|
+
"customers/shop/config_customer.json": '{"app":"shop"}',
|
|
24
|
+
"customers/shop/plugins/grid.js": "export {}",
|
|
25
|
+
}));
|
|
26
|
+
expect(checkout.customerPath).to.match(/customers[/\\]shop$/);
|
|
27
|
+
expect(readFileSync(path.join(checkout.customerPath, "plugins/grid.js"), "utf8")).to.equal("export {}");
|
|
28
|
+
await checkout.remove();
|
|
29
|
+
expect(existsSync(checkout.customerPath)).to.equal(false);
|
|
30
|
+
});
|
|
31
|
+
it("refuses a ref without the customer", async () => {
|
|
32
|
+
const error = await configAtRef("/repo/customers/new", "origin/main", repositoryWith({})).catch((error_) => error_);
|
|
33
|
+
expect(error.message).to.contain("no config at origin/main (f0f0f0f0) for customers/new");
|
|
34
|
+
});
|
|
35
|
+
it("reads the files where HEAD left the ref, so later changes on it do not show reversed", async () => {
|
|
36
|
+
const seen = [];
|
|
37
|
+
const checkout = await configAtRef("/repo/customers/shop", "origin/main", repositoryWith({ "customers/shop/config_customer.json": "{}" }, seen));
|
|
38
|
+
await checkout.remove();
|
|
39
|
+
expect(seen[0]).to.deep.equal(["merge-base", "HEAD", "origin/main"]);
|
|
40
|
+
expect(checkout.commit).to.equal("f0f0f0f0f0");
|
|
41
|
+
expect(seen.slice(1).map((args) => args.at(-1))).to.deep.equal([
|
|
42
|
+
"customers/shop",
|
|
43
|
+
"f0f0f0f0f0:customers/shop/config_customer.json",
|
|
44
|
+
]);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -37,6 +37,25 @@ describe("DiffServiceBuildContext", () => {
|
|
|
37
37
|
it("refuses --against the page itself", () => {
|
|
38
38
|
expect(() => create({ against: "https://shop.test/" })).to.throw("with itself");
|
|
39
39
|
});
|
|
40
|
+
it("renders the page with the config at --base, from --html in one variation", () => {
|
|
41
|
+
const context = create({
|
|
42
|
+
base: "origin/main",
|
|
43
|
+
html: "page.html",
|
|
44
|
+
variation: "mobile",
|
|
45
|
+
});
|
|
46
|
+
expect(context.base).to.equal("origin/main");
|
|
47
|
+
expect(context.html).to.equal("page.html");
|
|
48
|
+
expect(context.variation).to.equal("mobile");
|
|
49
|
+
});
|
|
50
|
+
it("refuses --base with the flags of the checks it replaces", () => {
|
|
51
|
+
expect(() => create({ base: "origin/main", params: true, baseline: true })).to.throw("does not take --params, --baseline");
|
|
52
|
+
});
|
|
53
|
+
it("refuses --base with --raw, which has no documentHandler", () => {
|
|
54
|
+
expect(() => create({ base: "origin/main", raw: true })).to.throw("needs the customer path and the documentHandler");
|
|
55
|
+
});
|
|
56
|
+
it("refuses --html without --base", () => {
|
|
57
|
+
expect(() => create({ html: "page.html" })).to.throw("for --base");
|
|
58
|
+
});
|
|
40
59
|
it("refuses --variation next to --variations", () => {
|
|
41
60
|
expect(() => create({ variation: "mobile", variations: ["tablet"] })).to.throw("pass one of them");
|
|
42
61
|
});
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
1
4
|
import { expect } from "chai";
|
|
2
5
|
import { describe, it } from "mocha";
|
|
3
6
|
import { DiffEngine } from "../diff-engine.js";
|
|
@@ -407,3 +410,95 @@ describe("DiffService variation", () => {
|
|
|
407
410
|
]);
|
|
408
411
|
});
|
|
409
412
|
});
|
|
413
|
+
/** A page source that renders whatever origin HTML it is given with `render`. */
|
|
414
|
+
function renderingSource(render) {
|
|
415
|
+
const origins = [];
|
|
416
|
+
const source = {
|
|
417
|
+
origins,
|
|
418
|
+
async origin(url, variation) {
|
|
419
|
+
origins.push(`${variation} ${url}`);
|
|
420
|
+
return { html: "<p>origin</p>" };
|
|
421
|
+
},
|
|
422
|
+
async fromHtml(html, _url, _variation, options) {
|
|
423
|
+
const content = render(html);
|
|
424
|
+
if (content instanceof PageSideFailure)
|
|
425
|
+
throw content;
|
|
426
|
+
return { label: options.label, content };
|
|
427
|
+
},
|
|
428
|
+
};
|
|
429
|
+
return source;
|
|
430
|
+
}
|
|
431
|
+
function baseService(before, after, options = {}) {
|
|
432
|
+
const shown = [];
|
|
433
|
+
const failed = [];
|
|
434
|
+
const removed = [];
|
|
435
|
+
const log = recordingLog();
|
|
436
|
+
const pages = renderingSource(after);
|
|
437
|
+
const diff = new DiffService({
|
|
438
|
+
options: {
|
|
439
|
+
pageUrl: "https://shop.test/c/shoes",
|
|
440
|
+
variation: "default",
|
|
441
|
+
base: "origin/main",
|
|
442
|
+
...options,
|
|
443
|
+
},
|
|
444
|
+
log,
|
|
445
|
+
engine: new DiffEngine({
|
|
446
|
+
sink: {
|
|
447
|
+
async show(result) {
|
|
448
|
+
shown.push(result);
|
|
449
|
+
return undefined;
|
|
450
|
+
},
|
|
451
|
+
fail(comparison) {
|
|
452
|
+
failed.push(comparison);
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
}),
|
|
456
|
+
pages,
|
|
457
|
+
base: {
|
|
458
|
+
pages: renderingSource(before),
|
|
459
|
+
remove: async () => {
|
|
460
|
+
removed.push("base");
|
|
461
|
+
},
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
return { diff, shown, failed, removed, log, pages };
|
|
465
|
+
}
|
|
466
|
+
describe("DiffService base", () => {
|
|
467
|
+
it("renders one origin page with both configs and shows the change", async () => {
|
|
468
|
+
const { diff, shown, removed, pages } = baseService((html) => `${html}<p>old</p>`, (html) => `${html}<p>new</p>`, { variation: "mobile" });
|
|
469
|
+
expect(await diff.run()).to.equal("differs");
|
|
470
|
+
expect(pages.origins).to.deep.equal(["mobile https://shop.test/c/shoes"]);
|
|
471
|
+
expect(shown[0].left.label).to.equal("config at origin/main");
|
|
472
|
+
expect(shown[0].right.label).to.equal("working tree");
|
|
473
|
+
expect(removed).to.deep.equal(["base"]);
|
|
474
|
+
});
|
|
475
|
+
it("finds no diff when the change leaves the page alone", async () => {
|
|
476
|
+
const { diff } = baseService((html) => html, (html) => html);
|
|
477
|
+
expect(await diff.run()).to.equal("equal");
|
|
478
|
+
});
|
|
479
|
+
it("is uncacheable with the handler's message when the working tree throws", async () => {
|
|
480
|
+
const thrown = new PageSideFailure({
|
|
481
|
+
url: "https://shop.test/c/shoes",
|
|
482
|
+
variation: "default",
|
|
483
|
+
failure: documentHandlerFailure(new DocumentHandlerTransformError(new TypeError("grid is undefined"))),
|
|
484
|
+
});
|
|
485
|
+
const { diff, failed, log } = baseService((html) => html, () => thrown);
|
|
486
|
+
expect(await diff.run()).to.equal("uncacheable");
|
|
487
|
+
expect(failed).to.have.length(1);
|
|
488
|
+
expect(log.lines.join("\n")).to.contain("grid is undefined");
|
|
489
|
+
});
|
|
490
|
+
it("renders a saved page instead of requesting it", async () => {
|
|
491
|
+
const dir = mkdtempSync(path.join(tmpdir(), "sk-diff-spec-"));
|
|
492
|
+
const file = path.join(dir, "page.html");
|
|
493
|
+
writeFileSync(file, "<p>saved</p>");
|
|
494
|
+
const { diff, shown, pages } = baseService((html) => html, (html) => html, { html: file });
|
|
495
|
+
try {
|
|
496
|
+
expect(await diff.run()).to.equal("equal");
|
|
497
|
+
expect(pages.origins).to.have.length(0);
|
|
498
|
+
expect(shown[0].left.content).to.equal("<p>saved</p>");
|
|
499
|
+
}
|
|
500
|
+
finally {
|
|
501
|
+
rmSync(dir, { recursive: true });
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
});
|
|
@@ -24,6 +24,8 @@ export declare class GitRepository {
|
|
|
24
24
|
changedPaths(request: MergedRequest): string[];
|
|
25
25
|
/** The paths below `directory` that the commit holds. */
|
|
26
26
|
pathsAt(sha: string, directory: string): string[];
|
|
27
|
+
/** The commit where HEAD left `ref`: `ref` itself when HEAD contains it. */
|
|
28
|
+
mergeBase(ref: string): string;
|
|
27
29
|
/** The content of one file in the commit. */
|
|
28
30
|
contentAt(sha: string, filePath: string): string;
|
|
29
31
|
/** The paths below `directory` that changed between the commit and HEAD. */
|
|
@@ -77,6 +77,10 @@ export class GitRepository {
|
|
|
77
77
|
.split("\n")
|
|
78
78
|
.filter((line) => line.length > 0);
|
|
79
79
|
}
|
|
80
|
+
/** The commit where HEAD left `ref`: `ref` itself when HEAD contains it. */
|
|
81
|
+
mergeBase(ref) {
|
|
82
|
+
return this.run(["merge-base", "HEAD", ref]).trim();
|
|
83
|
+
}
|
|
80
84
|
/** The content of one file in the commit. */
|
|
81
85
|
contentAt(sha, filePath) {
|
|
82
86
|
return this.run(["show", `${sha}:${filePath}`]);
|
|
@@ -111,6 +115,8 @@ function runGit(cwd) {
|
|
|
111
115
|
cwd,
|
|
112
116
|
encoding: "utf8",
|
|
113
117
|
maxBuffer: 32 * 1024 * 1024,
|
|
118
|
+
// The error below carries git's stderr; inherited, it would print twice.
|
|
119
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
114
120
|
});
|
|
115
121
|
}
|
|
116
122
|
catch (error) {
|
|
@@ -5,8 +5,24 @@ export declare class BaqendResponse implements Partial<Protocol.Fetch.FulfillReq
|
|
|
5
5
|
readonly body: string;
|
|
6
6
|
responseHeaders: Protocol.Fetch.HeaderEntry[];
|
|
7
7
|
private readonly contentType;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The size of the body as given, in bytes. Public because `body` is stored
|
|
10
|
+
* base64-encoded for Fetch.fulfillRequest, so its length is a third larger
|
|
11
|
+
* than the response it describes and means nothing to a reader.
|
|
12
|
+
*/
|
|
13
|
+
readonly contentLength: number;
|
|
9
14
|
constructor(body: string | Buffer, contentType?: string, headers?: Protocol.Fetch.HeaderEntry[], status?: number);
|
|
15
|
+
/**
|
|
16
|
+
* Rebuild a response that came back off disk, without re-running header
|
|
17
|
+
* augmentation.
|
|
18
|
+
*
|
|
19
|
+
* The constructor appends `via`, `Service-Worker-Allowed` and
|
|
20
|
+
* `Access-Control-Expose-Headers` unconditionally, so handing it headers it
|
|
21
|
+
* produced itself duplicates all three — on every cache hit, compounding.
|
|
22
|
+
* The stored headers are already final; they only need copying so a hit that
|
|
23
|
+
* sets `x-cache` does not write through to the cache's own array.
|
|
24
|
+
*/
|
|
25
|
+
static fromCache(body: Buffer, responseHeaders: Protocol.Fetch.HeaderEntry[], responseCode: number): BaqendResponse;
|
|
10
26
|
setHeader(name: string, value: string): void;
|
|
11
27
|
protected addCustomHeaders(headers?: Protocol.Fetch.HeaderEntry[]): Protocol.Fetch.HeaderEntry[];
|
|
12
28
|
}
|
|
@@ -19,6 +19,11 @@ export class BaqendResponse {
|
|
|
19
19
|
body;
|
|
20
20
|
responseHeaders;
|
|
21
21
|
contentType;
|
|
22
|
+
/**
|
|
23
|
+
* The size of the body as given, in bytes. Public because `body` is stored
|
|
24
|
+
* base64-encoded for Fetch.fulfillRequest, so its length is a third larger
|
|
25
|
+
* than the response it describes and means nothing to a reader.
|
|
26
|
+
*/
|
|
22
27
|
contentLength;
|
|
23
28
|
constructor(body, contentType, headers, status) {
|
|
24
29
|
this.responseCode = status || DEFAULT_STATUS;
|
|
@@ -32,6 +37,24 @@ export class BaqendResponse {
|
|
|
32
37
|
? body.toString("base64")
|
|
33
38
|
: Buffer.from(body).toString("base64");
|
|
34
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Rebuild a response that came back off disk, without re-running header
|
|
42
|
+
* augmentation.
|
|
43
|
+
*
|
|
44
|
+
* The constructor appends `via`, `Service-Worker-Allowed` and
|
|
45
|
+
* `Access-Control-Expose-Headers` unconditionally, so handing it headers it
|
|
46
|
+
* produced itself duplicates all three — on every cache hit, compounding.
|
|
47
|
+
* The stored headers are already final; they only need copying so a hit that
|
|
48
|
+
* sets `x-cache` does not write through to the cache's own array.
|
|
49
|
+
*/
|
|
50
|
+
static fromCache(body, responseHeaders, responseCode) {
|
|
51
|
+
const response = Object.create(BaqendResponse.prototype);
|
|
52
|
+
response.responseCode = responseCode;
|
|
53
|
+
response.contentLength = body.length;
|
|
54
|
+
response.body = body.toString("base64");
|
|
55
|
+
response.responseHeaders = responseHeaders.map((header) => ({ ...header }));
|
|
56
|
+
return response;
|
|
57
|
+
}
|
|
35
58
|
setHeader(name, value) {
|
|
36
59
|
const sanitized = sanitizeHeaderValue(value);
|
|
37
60
|
for (const header of this.responseHeaders) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Page } from "puppeteer";
|
|
2
|
+
import { CliServiceInterface } from "../../cli/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Records the page's console warnings and errors, and the errors it did not
|
|
5
|
+
* catch, into the run's log under the `console` scope, never on the
|
|
6
|
+
* terminal. `sk onboarding logs --scope console` reads them back, so "no
|
|
7
|
+
* console errors" can be checked after a test without a probe.
|
|
8
|
+
*/
|
|
9
|
+
export declare function recordConsole(page: Pick<Page, "on" | "url">, cli: Pick<CliServiceInterface, "logOnly">): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** The console types worth a line: a log of every `console.log` would bury the run. */
|
|
2
|
+
const LEVELS = {
|
|
3
|
+
warn: "warn",
|
|
4
|
+
warning: "warn",
|
|
5
|
+
error: "error",
|
|
6
|
+
assert: "error",
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Records the page's console warnings and errors, and the errors it did not
|
|
10
|
+
* catch, into the run's log under the `console` scope, never on the
|
|
11
|
+
* terminal. `sk onboarding logs --scope console` reads them back, so "no
|
|
12
|
+
* console errors" can be checked after a test without a probe.
|
|
13
|
+
*/
|
|
14
|
+
export function recordConsole(page, cli) {
|
|
15
|
+
page.on("console", (message) => {
|
|
16
|
+
const level = LEVELS[message.type()];
|
|
17
|
+
if (!level)
|
|
18
|
+
return;
|
|
19
|
+
cli.logOnly(level, message.text(), {
|
|
20
|
+
scope: "console",
|
|
21
|
+
data: { page: page.url(), source: message.location()?.url },
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
page.on("pageerror", (error) => {
|
|
25
|
+
cli.logOnly("error", error instanceof Error ? error.message : String(error), { scope: "console", data: { page: page.url(), uncaught: true } });
|
|
26
|
+
});
|
|
27
|
+
}
|