@astryxdesign/cli 0.7.6-canary.f73623d → 0.7.6-canary.f77aaf2
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/assets/docs/motion.doc.mjs +1 -1
- package/package.json +24 -10
- package/api/api-docs-parse.test.mjs +0 -47
- package/api/blog/_adapter.test.mjs +0 -183
- package/api/blog/blog.test.mjs +0 -144
- package/api/blog/detail/detail.test.mjs +0 -118
- package/api/blog/list/list.test.mjs +0 -81
- package/api/build/blocks/blocks.test.mjs +0 -238
- package/api/build/build.test.mjs +0 -569
- package/api/build/kit/answer.test.mjs +0 -108
- package/api/build/kit/rank.test.mjs +0 -380
- package/api/build/kit/weights.test.mjs +0 -286
- package/api/build/tree.test.mjs +0 -185
- package/api/component/component-replacement.test.mjs +0 -616
- package/api/component/component.test.mjs +0 -532
- package/api/component/doc-links.test.mjs +0 -419
- package/api/component/integration-export-name.test.mjs +0 -644
- package/api/component/integration-import-agreement.test.mjs +0 -474
- package/api/discover/_adapter.test.mjs +0 -839
- package/api/discover/_catalog-view.test.mjs +0 -129
- package/api/discover/_package-scanner.test.mjs +0 -117
- package/api/discover/detail/detail.test.mjs +0 -145
- package/api/discover/detail/doc/doc.test.mjs +0 -93
- package/api/discover/detail/item/item.test.mjs +0 -75
- package/api/discover/discover.test.mjs +0 -100
- package/api/discover/list/list.test.mjs +0 -107
- package/api/discover/search/search.test.mjs +0 -319
- package/api/docs/compiled-topics.test.mjs +0 -94
- package/api/docs/detail/section/section.test.mjs +0 -92
- package/api/docs/docOverlays.test.mjs +0 -189
- package/api/docs/docs-homes.test.mjs +0 -127
- package/api/docs/docs.depth.test.mjs +0 -134
- package/api/docs/docs.test.mjs +0 -315
- package/api/docs/guide-route-targets.test.mjs +0 -1002
- package/api/docs/index/index.test.mjs +0 -67
- package/api/docs/integration-tree.test.mjs +0 -616
- package/api/docs/integrationDocs.test.mjs +0 -546
- package/api/docs/namespace-section.test.mjs +0 -260
- package/api/docs/react-version-sync.test.mjs +0 -79
- package/api/docs/reference-blocks.test.mjs +0 -404
- package/api/docs/token-tables.test.mjs +0 -93
- package/api/doctor/built-checks.test.mjs +0 -537
- package/api/doctor/doctor.test.mjs +0 -1651
- package/api/doctor/icon-sets.test.mjs +0 -111
- package/api/doctor/release-checks.test.mjs +0 -156
- package/api/doctor/theme-checks.test.mjs +0 -884
- package/api/gap-report/gap-report.test.mjs +0 -1549
- package/api/hook/detail/detail.test.mjs +0 -53
- package/api/hook/detail/params/params.test.mjs +0 -39
- package/api/hook/hook.test.mjs +0 -75
- package/api/icon/all-or-nothing.test.mjs +0 -283
- package/api/icon/error-codes.test.mjs +0 -341
- package/api/icon/experimental-markers.test.mjs +0 -93
- package/api/icon/icon.test.mjs +0 -506
- package/api/icon/new-definition/new-definition.undo.test.mjs +0 -97
- package/api/icon/new-set/new-set.test.mjs +0 -398
- package/api/icon/option-pairs.test.mjs +0 -368
- package/api/init/init.test.mjs +0 -319
- package/api/init/remove/remove.test.mjs +0 -124
- package/api/init/user/user.test.mjs +0 -232
- package/api/integration/add-contribution.component-names.test.mjs +0 -186
- package/api/integration/add-contribution.test.mjs +0 -990
- package/api/integration/add-helpers.test.mjs +0 -161
- package/api/integration/add-theme.test.mjs +0 -676
- package/api/integration/authoring-checks.test.mjs +0 -1691
- package/api/integration/check/check.test.mjs +0 -538
- package/api/integration/doc-stability.test.mjs +0 -216
- package/api/integration/example-checks.no-npm.test.mjs +0 -140
- package/api/integration/example-checks.test.mjs +0 -776
- package/api/integration/integration-block-exports.test.mjs +0 -248
- package/api/integration/pack-check.component-replaces.test.mjs +0 -126
- package/api/integration/pack-check.lifecycle-output.test.mjs +0 -149
- package/api/integration/pack-check.test.mjs +0 -2512
- package/api/integration/public-api.test.mjs +0 -21
- package/api/integration/template-conflict-compatibility.test.mjs +0 -73
- package/api/integration/validate-installed-icon-sets.test.mjs +0 -67
- package/api/integration/validate-integration-case-disk.test.mjs +0 -123
- package/api/integration/validate-integration-fixes.test.mjs +0 -1457
- package/api/integration/validate-integration-gaps.test.mjs +0 -2007
- package/api/integration/validate-integration.test.mjs +0 -835
- package/api/integration/validate-unread-theme-folders.test.mjs +0 -111
- package/api/json/envelope-types.test.mjs +0 -76
- package/api/json/parse.test.mjs +0 -76
- package/api/render/render.test.mjs +0 -1155
- package/api/search/_adapter.test.mjs +0 -192
- package/api/search/_doc-searcher.test.mjs +0 -36
- package/api/search/_entries.test.mjs +0 -48
- package/api/search/_main-searcher.test.mjs +0 -106
- package/api/search/_order.test.mjs +0 -72
- package/api/search/_template-searcher.test.mjs +0 -40
- package/api/search/search-return-type.test.mjs +0 -54
- package/api/search/search.domain-priority.test.mjs +0 -351
- package/api/search/search.family-members.test.mjs +0 -124
- package/api/search/search.family-word.test.mjs +0 -146
- package/api/search/search.integration-block.test.mjs +0 -100
- package/api/search/search.integration-check.test.mjs +0 -24
- package/api/search/search.test.mjs +0 -1007
- package/api/search/search.tie-order.test.mjs +0 -39
- package/api/search/tree.test.mjs +0 -66
- package/api/swizzle/_github.test.mjs +0 -53
- package/api/swizzle/copy/copy.test.mjs +0 -60
- package/api/swizzle/swizzle.test.mjs +0 -157
- package/api/template/cdn/cdn.test.mjs +0 -108
- package/api/template/checkout-wizard.test.mjs +0 -87
- package/api/template/copy/copy.receipt.test.mjs +0 -77
- package/api/template/copy/copy.test.mjs +0 -77
- package/api/template/data-token-fallbacks.test.mjs +0 -85
- package/api/template/discover-integration-templates.test.mjs +0 -56
- package/api/template/form-wizard-dialog.test.mjs +0 -47
- package/api/template/inline-wizard-template.test.mjs +0 -24
- package/api/template/list/list.test.mjs +0 -52
- package/api/template/show/show.test.mjs +0 -76
- package/api/template/table-filter-view-tabs.test.mjs +0 -45
- package/api/template/table-floating-bulk-actions.test.mjs +0 -66
- package/api/template/template-integration.test.mjs +0 -1274
- package/api/template/template-suffix.test.mjs +0 -286
- package/api/template/template.test.mjs +0 -222
- package/api/template/tokenizer-showcase.test.mjs +0 -47
- package/api/template/unknown-name.test.mjs +0 -63
- package/api/theme/add/add.test.mjs +0 -363
- package/api/theme/add/add.types.test.mjs +0 -150
- package/api/theme/build/build.adaptation-core-compat.test.mjs +0 -394
- package/api/theme/build/build.adaptation-enrollment.test.mjs +0 -219
- package/api/theme/build/build.core-on-demand.test.mjs +0 -113
- package/api/theme/build/build.family.test.mjs +0 -503
- package/api/theme/build/build.font-warning.test.mjs +0 -170
- package/api/theme/build/build.heading-core-compat.test.mjs +0 -68
- package/api/theme/build/build.icon-entry-variants.test.mjs +0 -134
- package/api/theme/build/build.icon-function-entries.test.mjs +0 -499
- package/api/theme/build/build.icon-lineage.test.mjs +0 -117
- package/api/theme/build/build.icon-preservation.test.mjs +0 -639
- package/api/theme/build/build.icon-variants.test.mjs +0 -105
- package/api/theme/build/build.icons-specifier.test.mjs +0 -149
- package/api/theme/build/build.packed-old-core.test.mjs +0 -1512
- package/api/theme/build/build.project-core.test.mjs +0 -220
- package/api/theme/build/build.public-component-vars.test.mjs +0 -151
- package/api/theme/build/build.receipt-doc.test.mjs +0 -111
- package/api/theme/build/build.rollback.test.mjs +0 -148
- package/api/theme/build/build.test.mjs +0 -1258
- package/api/theme/build/font-warning.test.mjs +0 -268
- package/api/theme/eject/eject.binary.test.mjs +0 -90
- package/api/theme/eject/eject.copy-compat.test.mjs +0 -168
- package/api/theme/eject/eject.rollback.test.mjs +0 -158
- package/api/theme/eject/eject.staging.test.mjs +0 -83
- package/api/theme/eject/eject.test.mjs +0 -160
- package/api/theme/integration-themes.test.mjs +0 -218
- package/api/theme/list/list.test.mjs +0 -271
- package/api/theme/palette/generate/generate.test.mjs +0 -445
- package/api/theme/palette/generate/generator.test.mjs +0 -385
- package/api/theme/palette/generate/preview.test.mjs +0 -55
- package/api/theme/remove/remove.test.mjs +0 -94
- package/api/theme/targets/targets.test.mjs +0 -91
- package/api/theme/template/template.test.mjs +0 -102
- package/api/theme/use/use.test.mjs +0 -98
- package/api/upgrade/list/list.test.mjs +0 -73
- package/api/upgrade/project-context.test.mjs +0 -272
- package/api/upgrade/provider-agreement.test.mjs +0 -152
- package/api/upgrade/registry/registry.test.mjs +0 -911
- package/api/upgrade/run/authoring-codemod-reachable.test.mjs +0 -99
- package/api/upgrade/run/cli-behind-core.test.mjs +0 -438
- package/api/upgrade/run/failure-receipt.test.mjs +0 -212
- package/api/upgrade/run/files-changed.test.mjs +0 -111
- package/api/upgrade/run/outcomes.test.mjs +0 -646
- package/api/upgrade/run/run.test.mjs +0 -511
- package/api/upgrade/upgrade.test.mjs +0 -594
- package/assets/codemods/__tests__/registry.test.mjs +0 -77
- package/assets/codemods/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -65
- package/assets/codemods/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -58
- package/assets/codemods/__tests__/rename-section-wash-to-muted.test.mjs +0 -103
- package/assets/codemods/__tests__/runner.symlinks.test.mjs +0 -205
- package/assets/codemods/__tests__/runner.test.mjs +0 -559
- package/assets/codemods/__tests__/runner.unparseable.test.mjs +0 -457
- package/assets/codemods/__tests__/toolbar-density-to-size.test.mjs +0 -69
- package/assets/codemods/__tests__/validation.test.mjs +0 -108
- package/assets/codemods/file-count.test.mjs +0 -163
- package/assets/codemods/integration-discovery.test.mjs +0 -360
- package/assets/codemods/integration-runner.protection.test.mjs +0 -206
- package/assets/codemods/outcome.test.mjs +0 -40
- package/assets/codemods/term-log.test.mjs +0 -80
- package/assets/codemods/transform-prop.test.mjs +0 -130
- package/assets/codemods/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -144
- package/assets/codemods/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -193
- package/assets/codemods/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -81
- package/assets/codemods/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -126
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -129
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -126
- package/assets/codemods/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -95
- package/assets/codemods/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -109
- package/assets/codemods/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -44
- package/assets/codemods/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -110
- package/assets/codemods/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -71
- package/assets/codemods/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -137
- package/assets/codemods/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -161
- package/assets/codemods/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -137
- package/assets/codemods/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -110
- package/assets/codemods/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -61
- package/assets/codemods/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -130
- package/assets/codemods/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -89
- package/assets/codemods/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -74
- package/assets/codemods/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -140
- package/assets/codemods/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -116
- package/assets/codemods/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -79
- package/assets/codemods/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -130
- package/assets/codemods/transforms/v0.0.6/__tests__/migrate-badge-children-to-label.test.mjs +0 -46
- package/assets/codemods/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -72
- package/assets/codemods/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -98
- package/assets/codemods/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -117
- package/assets/codemods/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -75
- package/assets/codemods/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -275
- package/assets/codemods/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -85
- package/assets/codemods/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -327
- package/assets/codemods/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -98
- package/assets/codemods/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +0 -460
- package/assets/codemods/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -103
- package/assets/codemods/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -61
- package/assets/codemods/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +0 -123
- package/assets/codemods/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -104
- package/assets/codemods/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -120
- package/assets/codemods/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -574
- package/assets/codemods/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -93
- package/assets/codemods/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -120
- package/assets/codemods/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -112
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +0 -129
- package/assets/codemods/transforms/v0.2.0/__tests__/remove-tablist-orientation.test.mjs +0 -81
- package/assets/codemods/transforms/v0.2.1/__tests__/migrate-dialog-position-to-logical.test.mjs +0 -119
- package/assets/codemods/transforms/v0.3.0/__tests__/authoring-migration.e2e.test.mjs +0 -296
- package/assets/codemods/transforms/v0.3.0/__tests__/authoring-migration.tsc.test.mjs +0 -139
- package/assets/codemods/transforms/v0.3.0/__tests__/migrate-authoring-imports.test.mjs +0 -80
- package/assets/codemods/transforms/v0.3.0/__tests__/migrate-grid-minchildwidth-to-columns.test.mjs +0 -82
- package/assets/codemods/transforms/v0.3.0/__tests__/next-codemods.test.mjs +0 -64
- package/assets/codemods/transforms/v0.3.0/__tests__/rename-authoring-doctypes.test.mjs +0 -94
- package/assets/codemods/transforms/v0.3.0/__tests__/rename-radiogroup-arialabel-to-label.test.mjs +0 -86
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +0 -170
- package/assets/codemods/transforms/v0.4.0/__tests__/migrate-table-rowexpansion-to-tree.test.mjs +0 -201
- package/assets/codemods/transforms/v0.4.0/__tests__/next-codemods.test.mjs +0 -154
- package/assets/codemods/transforms/v0.5.0/__tests__/next-codemods.test.mjs +0 -127
- package/assets/codemods/transforms/v0.6.0/__tests__/migrate-astryx-theme-selectors-to-data-attrs.test.mjs +0 -398
- package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +0 -270
- package/assets/codemods/transforms/v0.6.4/__tests__/migrate-native-picker-to-presentation.test.mjs +0 -63
- package/assets/codemods/transforms/v0.6.4/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +0 -220
- package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +0 -129
- package/assets/codemods/transforms/v0.7.0/__tests__/migrate-deprecated-theme-surface.test.mjs +0 -523
- package/assets/codemods/transforms/v0.7.0/__tests__/migrate-field-input-styling.test.mjs +0 -108
- package/assets/codemods/transforms/v0.7.0/__tests__/preserve-bottom-sheet-content-padding.test.mjs +0 -178
- package/assets/codemods/transforms/v0.7.0/__tests__/rename-empty-search-results-text.test.mjs +0 -202
- package/assets/codemods/transforms/v0.7.0/__tests__/validate-data-token-ownership.test.mjs +0 -168
- package/assets/codemods/transforms/v0.7.2/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +0 -120
- package/assets/codemods/transforms/v0.7.5/__tests__/migrate-codeblock-tokenizer-to-language.test.mjs +0 -130
- package/authoring/_shared/errors.test.mjs +0 -49
- package/authoring/codemod/parse.test.mjs +0 -99
- package/authoring/config/debug-composition.test.mjs +0 -92
- package/authoring/config/parse.test.mjs +0 -121
- package/authoring/debug/parse.test.mjs +0 -187
- package/authoring/discover/parse.test.mjs +0 -158
- package/authoring/doctypes/doc-stability-types.test.mjs +0 -91
- package/authoring/doctypes/doctypes-new.test.mjs +0 -162
- package/authoring/doctypes/icon-definition/parse.test.mjs +0 -78
- package/authoring/doctypes/icon-set/icon-names.test.mjs +0 -26
- package/authoring/doctypes/icon-set/parse.test.mjs +0 -179
- package/authoring/doctypes/load-contract.test.mjs +0 -246
- package/authoring/doctypes/namespace/parse.test.mjs +0 -163
- package/authoring/doctypes/parse.test.mjs +0 -422
- package/authoring/doctypes/template/parse.test.mjs +0 -198
- package/authoring/gap-report/parse.test.mjs +0 -172
- package/authoring/integration/parse.test.mjs +0 -184
- package/authoring/shadcn/receipt.test.mjs +0 -187
- package/authoring/shadcn/source-variants.test.mjs +0 -120
- package/clients/cli/__tests__/cliManifest.test.ts +0 -37
- package/clients/cli/cli-command.test.mjs +0 -166
- package/clients/cli/cli-exit-codes.test.mjs +0 -163
- package/clients/cli/command-load-failure.test.mjs +0 -83
- package/clients/cli/command-result-coverage.test.mjs +0 -136
- package/clients/cli/commands/blog.test.mjs +0 -138
- package/clients/cli/commands/build-theme.adaptations.test.mjs +0 -773
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +0 -198
- package/clients/cli/commands/build-theme.batch-report.test.mjs +0 -349
- package/clients/cli/commands/build-theme.color-scheme.test.mjs +0 -136
- package/clients/cli/commands/build-theme.data-tokens.test.mjs +0 -92
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +0 -110
- package/clients/cli/commands/build-theme.font-warning.test.mjs +0 -170
- package/clients/cli/commands/build-theme.icons-specifier.test.mjs +0 -350
- package/clients/cli/commands/build-theme.import-path.test.mjs +0 -103
- package/clients/cli/commands/build-theme.multi.test.mjs +0 -148
- package/clients/cli/commands/build-theme.outside-project.test.mjs +0 -140
- package/clients/cli/commands/build-theme.path-safety.test.mjs +0 -398
- package/clients/cli/commands/build-theme.prose.test.mjs +0 -103
- package/clients/cli/commands/build-theme.registry.test.mjs +0 -160
- package/clients/cli/commands/build-theme.variants.test.mjs +0 -560
- package/clients/cli/commands/build-theme.watch.test.mjs +0 -320
- package/clients/cli/commands/build.error-codes.test.mjs +0 -50
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +0 -54
- package/clients/cli/commands/build.playbook.test.mjs +0 -75
- package/clients/cli/commands/build.text-fields.test.mjs +0 -81
- package/clients/cli/commands/cli-postinstall.test.mjs +0 -90
- package/clients/cli/commands/component-batch.test.mjs +0 -341
- package/clients/cli/commands/component-ownership.test.mjs +0 -384
- package/clients/cli/commands/component-package.test.mjs +0 -169
- package/clients/cli/commands/component-replacement.text.test.mjs +0 -316
- package/clients/cli/commands/component-resolution.test.mjs +0 -204
- package/clients/cli/commands/component.test.mjs +0 -612
- package/clients/cli/commands/debug-result-summary.test.mjs +0 -214
- package/clients/cli/commands/detail-levels.test.mjs +0 -145
- package/clients/cli/commands/dialog-adaptive-template.test.mjs +0 -24
- package/clients/cli/commands/discover.broken-integration.test.mjs +0 -163
- package/clients/cli/commands/discover.components-flag.test.mjs +0 -97
- package/clients/cli/commands/discover.icon-sets.test.mjs +0 -133
- package/clients/cli/commands/discover.no-source.test.mjs +0 -490
- package/clients/cli/commands/discover.sources.test.mjs +0 -292
- package/clients/cli/commands/discover.text-projection.test.mjs +0 -103
- package/clients/cli/commands/docs.depth.test.mjs +0 -219
- package/clients/cli/commands/docs.test.mjs +0 -385
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +0 -53
- package/clients/cli/commands/doctor-integration.test.mjs +0 -1483
- package/clients/cli/commands/doctor.test.mjs +0 -509
- package/clients/cli/commands/empty-argument.test.mjs +0 -16
- package/clients/cli/commands/external-showcase.test.mjs +0 -121
- package/clients/cli/commands/gap-report.test.mjs +0 -412
- package/clients/cli/commands/hook.text-projection.test.mjs +0 -45
- package/clients/cli/commands/icon-authoring.test.mjs +0 -2845
- package/clients/cli/commands/icon-options-wiring.test.mjs +0 -158
- package/clients/cli/commands/icon-sets-guide.test.mjs +0 -186
- package/clients/cli/commands/icon.test.mjs +0 -96
- package/clients/cli/commands/import-hint-correctness.test.mjs +0 -293
- package/clients/cli/commands/init.behavior.test.mjs +0 -434
- package/clients/cli/commands/init.flag-help.test.mjs +0 -151
- package/clients/cli/commands/init.next-steps.test.mjs +0 -41
- package/clients/cli/commands/integration-add.controls.test.mjs +0 -132
- package/clients/cli/commands/integration-authoring.test.mjs +0 -288
- package/clients/cli/commands/integration-check.test.mjs +0 -522
- package/clients/cli/commands/integration-real-world.test.mjs +0 -661
- package/clients/cli/commands/interactive-guard.test.mjs +0 -143
- package/clients/cli/commands/json-contract.test.mjs +0 -216
- package/clients/cli/commands/no-prompt-wording.test.mjs +0 -94
- package/clients/cli/commands/option-pair-refusals.test.mjs +0 -37
- package/clients/cli/commands/outside-project.test.mjs +0 -874
- package/clients/cli/commands/search.test.mjs +0 -514
- package/clients/cli/commands/setup-nudge.test.mjs +0 -280
- package/clients/cli/commands/silent-success-refusals.test.mjs +0 -15
- package/clients/cli/commands/swizzle.path-safety.test.mjs +0 -137
- package/clients/cli/commands/swizzle.routing.test.mjs +0 -342
- package/clients/cli/commands/template-cdn.behavior.test.mjs +0 -113
- package/clients/cli/commands/template.copy-receipt.test.mjs +0 -60
- package/clients/cli/commands/template.flag-help.test.mjs +0 -124
- package/clients/cli/commands/template.icons.test.mjs +0 -132
- package/clients/cli/commands/template.path-help.test.mjs +0 -40
- package/clients/cli/commands/template.path-safety.test.mjs +0 -82
- package/clients/cli/commands/template.show-media.test.mjs +0 -62
- package/clients/cli/commands/template.test.mjs +0 -62
- package/clients/cli/commands/text-json-parity.test.mjs +0 -850
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +0 -228
- package/clients/cli/commands/theme-list.behavior.test.mjs +0 -51
- package/clients/cli/commands/theme-palette-generate.test.mjs +0 -154
- package/clients/cli/commands/theme-targets.behavior.test.mjs +0 -84
- package/clients/cli/commands/theme-template.behavior.test.mjs +0 -97
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +0 -101
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +0 -342
- package/clients/cli/commands/upgrade.file-protection.test.mjs +0 -404
- package/clients/cli/commands/upgrade.flag-help.test.mjs +0 -221
- package/clients/cli/commands/upgrade.hook-output.test.mjs +0 -89
- package/clients/cli/commands/upgrade.integration-policy.test.mjs +0 -581
- package/clients/cli/commands/upgrade.older-cli.test.mjs +0 -160
- package/clients/cli/commands/upgrade.outcomes.test.mjs +0 -350
- package/clients/cli/commands/upgrade.subfolder-path.test.mjs +0 -97
- package/clients/cli/commands/upgrade.test.mjs +0 -361
- package/clients/cli/commands/validate-nothing-exits-nonzero.test.mjs +0 -67
- package/clients/cli/commands/write-failure.test.mjs +0 -175
- package/clients/cli/e2e-smoke.test.mjs +0 -162
- package/clients/cli/error-envelope-code.test.mjs +0 -38
- package/clients/cli/formatters/index.test.mjs +0 -262
- package/clients/cli/latest-version-env.test.mjs +0 -50
- package/clients/cli/lib/cli-error.test.mjs +0 -206
- package/clients/cli/lib/component-format.test.mjs +0 -246
- package/clients/cli/lib/define-command.test.mjs +0 -103
- package/clients/cli/lib/doc-text-ascii.test.mjs +0 -85
- package/clients/cli/lib/exit-codes.test.mjs +0 -111
- package/clients/cli/lib/hook-format.test.mjs +0 -35
- package/clients/cli/lib/json-shim.test.mjs +0 -268
- package/clients/cli/lib/manifest.test.mjs +0 -346
- package/clients/cli/lib/parse-error-format.test.mjs +0 -81
- package/clients/cli/lib/resolve-theme.test.mjs +0 -543
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +0 -1550
- package/foundation/agent-docs/agent-docs.test.mjs +0 -1937
- package/foundation/agent-docs/app-theme-workflow.test.mjs +0 -16
- package/foundation/agent-docs/computer-agent-text.test.mjs +0 -699
- package/foundation/config/config-cache.test.mjs +0 -83
- package/foundation/config/config-writer.test.mjs +0 -84
- package/foundation/config/integration-debug.test.mjs +0 -218
- package/foundation/config/project-themes.test.mjs +0 -119
- package/foundation/config/project.test.mjs +0 -931
- package/foundation/config/theme-private-vars.test.mjs +0 -76
- package/foundation/config/theme-state.test.mjs +0 -182
- package/foundation/debug/debug-fields.test.mjs +0 -327
- package/foundation/debug/integration-handlers.test.mjs +0 -267
- package/foundation/debug/on-event.test.mjs +0 -643
- package/foundation/debug/privacy-contract.test.mjs +0 -195
- package/foundation/debug/redact.test.mjs +0 -534
- package/foundation/discovery/authoring-self-docs.test.mjs +0 -202
- package/foundation/discovery/authoring-surface.test.mjs +0 -392
- package/foundation/discovery/cli-self-docs.test.mjs +0 -396
- package/foundation/discovery/component-discovery.export-names.test.mjs +0 -832
- package/foundation/discovery/component-discovery.importpath.test.mjs +0 -59
- package/foundation/discovery/component-discovery.test.mjs +0 -336
- package/foundation/discovery/component-loader.test.mjs +0 -190
- package/foundation/discovery/component-replacement.test.mjs +0 -520
- package/foundation/discovery/componentDocOverlay.test.mjs +0 -159
- package/foundation/discovery/copied-passages.test.mjs +0 -124
- package/foundation/discovery/doc-consistency.test.mjs +0 -347
- package/foundation/discovery/doc-fluff.test.mjs +0 -142
- package/foundation/discovery/doc-types.test.mjs +0 -774
- package/foundation/discovery/docs-discovery.test.mjs +0 -707
- package/foundation/discovery/docs-section-key.test.mjs +0 -246
- package/foundation/discovery/hook-discovery.test.mjs +0 -216
- package/foundation/discovery/icon-set-checks.test.mjs +0 -1018
- package/foundation/discovery/icon-set-discovery.test.mjs +0 -320
- package/foundation/discovery/icon-set-writer.test.mjs +0 -26
- package/foundation/discovery/integration-doc-files.test.mjs +0 -275
- package/foundation/discovery/module-exports.test.mjs +0 -209
- package/foundation/discovery/package-tsconfig.test.mjs +0 -210
- package/foundation/discovery/prop-drift.test.mjs +0 -2337
- package/foundation/discovery/runner-commands.test.mjs +0 -131
- package/foundation/discovery/stray-pointers.test.mjs +0 -92
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +0 -284
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +0 -94
- package/foundation/discovery/template-adapter.test.mjs +0 -223
- package/foundation/discovery/template-conflict-release.test.mjs +0 -40
- package/foundation/discovery/template-icons.test.mjs +0 -560
- package/foundation/discovery/template-needs.test.mjs +0 -306
- package/foundation/discovery/theme-discovery.test.mjs +0 -775
- package/foundation/discovery/theme-imports.test.mjs +0 -173
- package/foundation/discovery/theming-targets.test.mjs +0 -328
- package/foundation/discovery/type-match.test.mjs +0 -169
- package/foundation/discovery/type-text.test.mjs +0 -196
- package/foundation/discovery/unresolved-references.test.mjs +0 -567
- package/foundation/doc-compiler/bundle.test.mjs +0 -266
- package/foundation/doc-compiler/doc-compiler.test.mjs +0 -714
- package/foundation/doc-compiler/doc-loads.test.mjs +0 -1762
- package/foundation/doc-compiler/doc-syntax.test.mjs +0 -383
- package/foundation/doc-compiler/inputs.test.mjs +0 -298
- package/foundation/doc-compiler/links.test.mjs +0 -285
- package/foundation/doc-compiler/lower-doc.test.mjs +0 -495
- package/foundation/doc-compiler/read.test.mjs +0 -380
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +0 -74
- package/foundation/doc-compiler/tree.test.mjs +0 -691
- package/foundation/env/cli-command.test.mjs +0 -129
- package/foundation/env/node-version.test.mjs +0 -103
- package/foundation/env/package-manager.global.test.mjs +0 -66
- package/foundation/env/package-manager.test.mjs +0 -910
- package/foundation/env/search-path.test.mjs +0 -122
- package/foundation/env/semver.test.mjs +0 -111
- package/foundation/env/user-dirs.test.mjs +0 -72
- package/foundation/env/user-settings.test.mjs +0 -64
- package/foundation/fs/file-protection.test.mjs +0 -250
- package/foundation/fs/listing-cache.test.mjs +0 -88
- package/foundation/fs/module-loader.stdout.test.mjs +0 -333
- package/foundation/fs/module-loader.test.mjs +0 -410
- package/foundation/fs/path-safety.test.mjs +0 -222
- package/foundation/fs/paths.test.mjs +0 -725
- package/foundation/fs/publish-file-eperm-mutation.test.mjs +0 -64
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +0 -142
- package/foundation/fs/publish-file.test.mjs +0 -136
- package/foundation/fs/read-record.test.mjs +0 -164
- package/foundation/identity/provider-identity.test.mjs +0 -254
- package/foundation/integrations/autolink.test.mjs +0 -430
- package/foundation/integrations/cli-peer-version.test.mjs +0 -354
- package/foundation/integrations/cli-requirement.test.mjs +0 -383
- package/foundation/integrations/computer-integrations.test.mjs +0 -292
- package/foundation/integrations/contribution-inventory.test.mjs +0 -420
- package/foundation/integrations/integration-warnings.test.mjs +0 -191
- package/foundation/integrations/integrations.test.mjs +0 -818
- package/foundation/integrations/manifest-writer.test.mjs +0 -271
- package/foundation/integrations/provider-conflicts.test.mjs +0 -125
- package/foundation/integrations/provider-ledger.test.mjs +0 -275
- package/foundation/integrations/provider-resolution.test.mjs +0 -369
- package/foundation/integrations/public-imports.test.mjs +0 -1818
- package/foundation/release/cache.test.mjs +0 -923
- package/foundation/release/choose.test.mjs +0 -427
- package/foundation/release/global-state.test.mjs +0 -381
- package/foundation/release/handoff.e2e.test.mjs +0 -278
- package/foundation/release/notices.test.mjs +0 -586
- package/foundation/release/project.test.mjs +0 -288
- package/foundation/render/render.test.mjs +0 -117
- package/foundation/response/error-codes.test.mjs +0 -297
- package/foundation/response/json-contract.test.mjs +0 -235
- package/foundation/response/json-serialize.test.mjs +0 -66
- package/foundation/response/response-types.doc.test.mjs +0 -278
- package/foundation/route/route.test.mjs +0 -153
- package/foundation/runtime/hosted-runtime.test.mjs +0 -403
- package/foundation/runtime/package-set.test.mjs +0 -432
- package/foundation/text/copyright-header.test.mjs +0 -58
- package/foundation/text/levenshtein.test.mjs +0 -53
- package/foundation/text/string-utils.test.mjs +0 -175
- package/foundation/text/suggest-order.test.mjs +0 -312
- package/foundation/xle/browser-imports.test.mjs +0 -74
- package/foundation/xle/expand.test.mjs +0 -54
- package/foundation/xle/print.test.mjs +0 -50
- package/foundation/xle/registry.test.mjs +0 -28
- package/foundation/xle/xle.test.mjs +0 -382
- package/host/door-conformance.test.mjs +0 -274
- package/host/index.test.mjs +0 -302
|
@@ -1,1549 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {spawnSync} from 'node:child_process';
|
|
4
|
-
import * as fs from 'node:fs';
|
|
5
|
-
import * as os from 'node:os';
|
|
6
|
-
import * as path from 'node:path';
|
|
7
|
-
import {afterEach, beforeEach, describe, expect, it, vi} from 'vitest';
|
|
8
|
-
import {Project} from '../../foundation/config/project.mjs';
|
|
9
|
-
import {
|
|
10
|
-
ASK_DESTINATION_MESSAGE,
|
|
11
|
-
GAP_REPORT_CATEGORIES,
|
|
12
|
-
PUBLIC_CONFIRMATION_MESSAGE,
|
|
13
|
-
collectGapReportHandlers,
|
|
14
|
-
deliverGapReportHandlers,
|
|
15
|
-
gapReport,
|
|
16
|
-
} from './gap-report.mjs';
|
|
17
|
-
|
|
18
|
-
let projectDir;
|
|
19
|
-
|
|
20
|
-
function configure(integrations = [], opts = {}) {
|
|
21
|
-
const config = {integrations, ...opts};
|
|
22
|
-
fs.writeFileSync(
|
|
23
|
-
path.join(projectDir, 'astryx.config.mjs'),
|
|
24
|
-
`export default ${JSON.stringify(config)};\n`,
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function packageDir(packageName) {
|
|
29
|
-
return path.join(projectDir, 'node_modules', ...packageName.split('/'));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function addCoreComponent(component = 'Button') {
|
|
33
|
-
const coreDir = packageDir('@astryxdesign/core');
|
|
34
|
-
const componentDir = path.join(coreDir, 'src', component);
|
|
35
|
-
fs.mkdirSync(componentDir, {recursive: true});
|
|
36
|
-
fs.writeFileSync(
|
|
37
|
-
path.join(coreDir, 'package.json'),
|
|
38
|
-
JSON.stringify({name: '@astryxdesign/core', version: '0.5.4'}),
|
|
39
|
-
);
|
|
40
|
-
fs.writeFileSync(
|
|
41
|
-
path.join(componentDir, `${component}.doc.mjs`),
|
|
42
|
-
`export default {name: ${JSON.stringify(component)}, usage: {description: 'Core fixture'}, props: []};\n`,
|
|
43
|
-
);
|
|
44
|
-
fs.writeFileSync(
|
|
45
|
-
path.join(componentDir, `${component}.tsx`),
|
|
46
|
-
`export const ${component} = null;\n`,
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Add an integration with a handler (function-based, not executable).
|
|
52
|
-
* @param {object} opts
|
|
53
|
-
* @param {string} opts.name
|
|
54
|
-
* @param {'internal'|'public'} [opts.audience]
|
|
55
|
-
* @param {string} [opts.issuesUrl]
|
|
56
|
-
* @param {string} [opts.component]
|
|
57
|
-
* @param {boolean} [opts.handler] whether to export a gapReport handler
|
|
58
|
-
* @param {string} [opts.handleBody] JS code for the handle function body
|
|
59
|
-
* @param {string} [opts.malformedExport] raw JS to export instead of a proper handler
|
|
60
|
-
*/
|
|
61
|
-
function addIntegration({
|
|
62
|
-
name,
|
|
63
|
-
audience = 'public',
|
|
64
|
-
issuesUrl,
|
|
65
|
-
component,
|
|
66
|
-
handler = true,
|
|
67
|
-
handleBody = "return {status: 'filed', message: 'Handled by ' + " +
|
|
68
|
-
JSON.stringify(name) +
|
|
69
|
-
'};',
|
|
70
|
-
malformedExport,
|
|
71
|
-
}) {
|
|
72
|
-
const dir = packageDir(name);
|
|
73
|
-
fs.mkdirSync(dir, {recursive: true});
|
|
74
|
-
fs.writeFileSync(
|
|
75
|
-
path.join(dir, 'package.json'),
|
|
76
|
-
JSON.stringify({name, version: '1.2.3'}),
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const manifest = {};
|
|
80
|
-
if (issuesUrl) manifest.issuesUrl = issuesUrl;
|
|
81
|
-
if (component) {
|
|
82
|
-
manifest.components = './components';
|
|
83
|
-
const components = path.join(dir, 'components');
|
|
84
|
-
fs.mkdirSync(components, {recursive: true});
|
|
85
|
-
fs.writeFileSync(
|
|
86
|
-
path.join(components, `${component}.doc.mjs`),
|
|
87
|
-
`export default {name: ${JSON.stringify(component)}, usage: {description: 'Fixture'}, props: []};\n`,
|
|
88
|
-
);
|
|
89
|
-
fs.writeFileSync(
|
|
90
|
-
path.join(components, `${component}.tsx`),
|
|
91
|
-
`export const ${component} = null;\n`,
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
let namedExport = '';
|
|
96
|
-
if (malformedExport != null) {
|
|
97
|
-
namedExport = malformedExport;
|
|
98
|
-
} else if (handler) {
|
|
99
|
-
namedExport = `export const gapReport = {\n audience: ${JSON.stringify(audience)},\n handle: async (report, {signal}) => { ${handleBody} },\n};\n`;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
fs.writeFileSync(
|
|
103
|
-
path.join(dir, 'astryx.integration.mjs'),
|
|
104
|
-
`${namedExport}export default ${JSON.stringify(manifest)};\n`,
|
|
105
|
-
);
|
|
106
|
-
return {dir};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Add an integration whose module throws on import, so it never loads.
|
|
111
|
-
* @param {string} name
|
|
112
|
-
*/
|
|
113
|
-
function addBrokenIntegration(name) {
|
|
114
|
-
const dir = packageDir(name);
|
|
115
|
-
fs.mkdirSync(dir, {recursive: true});
|
|
116
|
-
fs.writeFileSync(
|
|
117
|
-
path.join(dir, 'package.json'),
|
|
118
|
-
JSON.stringify({name, version: '1.0.0', type: 'module'}),
|
|
119
|
-
);
|
|
120
|
-
fs.writeFileSync(
|
|
121
|
-
path.join(dir, 'astryx.integration.mjs'),
|
|
122
|
-
"throw new Error('intentional integration load failure');\n",
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Put a fake `gh` first on PATH that records its arguments if it is called.
|
|
128
|
-
* @returns {string} the file the fake writes when invoked
|
|
129
|
-
*/
|
|
130
|
-
function stubGh() {
|
|
131
|
-
const binDir = path.join(projectDir, 'bin');
|
|
132
|
-
const argsFile = path.join(projectDir, 'gh-args.json');
|
|
133
|
-
fs.mkdirSync(binDir, {recursive: true});
|
|
134
|
-
fs.writeFileSync(
|
|
135
|
-
path.join(binDir, 'gh'),
|
|
136
|
-
`#!/usr/bin/env node
|
|
137
|
-
import fs from 'node:fs';
|
|
138
|
-
fs.writeFileSync(${JSON.stringify(argsFile)}, JSON.stringify(process.argv.slice(2)));
|
|
139
|
-
console.log('https://github.com/acme/core/issues/42');
|
|
140
|
-
`,
|
|
141
|
-
{mode: 0o755},
|
|
142
|
-
);
|
|
143
|
-
fs.chmodSync(path.join(binDir, 'gh'), 0o755);
|
|
144
|
-
vi.stubEnv('PATH', `${binDir}${path.delimiter}${process.env.PATH ?? ''}`);
|
|
145
|
-
return argsFile;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const reportOptions = {
|
|
149
|
-
category: 'missing_variant',
|
|
150
|
-
reason: 'Need a compact size',
|
|
151
|
-
detail: 'The current size does not fit the toolbar.',
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
beforeEach(() => {
|
|
155
|
-
projectDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-gap-report-'));
|
|
156
|
-
fs.writeFileSync(
|
|
157
|
-
path.join(projectDir, 'package.json'),
|
|
158
|
-
JSON.stringify({name: 'fixture-app'}),
|
|
159
|
-
);
|
|
160
|
-
configure();
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
afterEach(() => {
|
|
164
|
-
vi.unstubAllEnvs();
|
|
165
|
-
fs.rmSync(projectDir, {recursive: true, force: true});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
describe('gapReport categories and validation', () => {
|
|
169
|
-
it('preserves the legacy category vocabulary', async () => {
|
|
170
|
-
const result = await gapReport(undefined, {listCategories: true});
|
|
171
|
-
expect(result).toEqual({
|
|
172
|
-
type: 'gap-report.categories',
|
|
173
|
-
data: GAP_REPORT_CATEGORIES,
|
|
174
|
-
});
|
|
175
|
-
expect(result.data.map(item => item.value)).toEqual([
|
|
176
|
-
'missing_component',
|
|
177
|
-
'missing_variant',
|
|
178
|
-
'layout_gap',
|
|
179
|
-
'styling_gap',
|
|
180
|
-
'a11y_gap',
|
|
181
|
-
'api_friction',
|
|
182
|
-
'docs_gap',
|
|
183
|
-
'other',
|
|
184
|
-
]);
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it('rejects missing, unknown, and oversized report fields', async () => {
|
|
188
|
-
await expect(
|
|
189
|
-
gapReport(undefined, {...reportOptions, cwd: projectDir}),
|
|
190
|
-
).rejects.toMatchObject({code: 'ERR_MISSING_ARGUMENT'});
|
|
191
|
-
await expect(
|
|
192
|
-
gapReport('Button', {
|
|
193
|
-
...reportOptions,
|
|
194
|
-
category: 'not_real',
|
|
195
|
-
cwd: projectDir,
|
|
196
|
-
}),
|
|
197
|
-
).rejects.toMatchObject({code: 'ERR_UNKNOWN_CATEGORY'});
|
|
198
|
-
await expect(
|
|
199
|
-
gapReport('Button', {
|
|
200
|
-
...reportOptions,
|
|
201
|
-
detail: 'x'.repeat(8001),
|
|
202
|
-
cwd: projectDir,
|
|
203
|
-
}),
|
|
204
|
-
).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
describe('gapReport fan-out composition', () => {
|
|
209
|
-
it('project handler and integration handler both run in order', async () => {
|
|
210
|
-
const name = '@test/integration-one';
|
|
211
|
-
addIntegration({
|
|
212
|
-
name,
|
|
213
|
-
audience: 'internal',
|
|
214
|
-
handleBody: "return {status: 'filed', message: 'from integration'};",
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
// Write config with project handler + integration
|
|
218
|
-
fs.writeFileSync(
|
|
219
|
-
path.join(projectDir, 'astryx.config.mjs'),
|
|
220
|
-
`
|
|
221
|
-
export default {
|
|
222
|
-
integrations: [${JSON.stringify(name)}],
|
|
223
|
-
gapReport: {
|
|
224
|
-
audience: 'internal',
|
|
225
|
-
handle: (report) => ({status: 'filed', message: 'from project'}),
|
|
226
|
-
},
|
|
227
|
-
};
|
|
228
|
-
`,
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
const result = await gapReport('General', {
|
|
232
|
-
...reportOptions,
|
|
233
|
-
cwd: projectDir,
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
expect(result.data.status).toBe('filed');
|
|
237
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
238
|
-
expect(
|
|
239
|
-
result.data.deliveries.map(({handlerType, handler, audience}) => ({
|
|
240
|
-
handlerType,
|
|
241
|
-
handler,
|
|
242
|
-
audience,
|
|
243
|
-
})),
|
|
244
|
-
).toEqual([
|
|
245
|
-
{handlerType: 'project', handler: 'project', audience: 'internal'},
|
|
246
|
-
{
|
|
247
|
-
handlerType: 'integration',
|
|
248
|
-
handler: name,
|
|
249
|
-
audience: 'internal',
|
|
250
|
-
},
|
|
251
|
-
]);
|
|
252
|
-
expect(result.data.deliveries[0].message).toBe('from project');
|
|
253
|
-
expect(result.data.deliveries[1].message).toBe('from integration');
|
|
254
|
-
expect(result.data.filedCount).toBe(2);
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
it('runs the self-resolved local package handler', async () => {
|
|
258
|
-
fs.writeFileSync(
|
|
259
|
-
path.join(projectDir, 'package.json'),
|
|
260
|
-
JSON.stringify({name: '@test/local', version: '1.0.0'}),
|
|
261
|
-
);
|
|
262
|
-
fs.writeFileSync(
|
|
263
|
-
path.join(projectDir, 'astryx.integration.mjs'),
|
|
264
|
-
`export const gapReport = {
|
|
265
|
-
audience: 'internal',
|
|
266
|
-
handle(report) { return {status: 'filed', message: report.component}; },
|
|
267
|
-
};
|
|
268
|
-
export default {};
|
|
269
|
-
`,
|
|
270
|
-
);
|
|
271
|
-
|
|
272
|
-
const result = await gapReport('General', {
|
|
273
|
-
...reportOptions,
|
|
274
|
-
cwd: projectDir,
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
expect(result.data.deliveries).toEqual([
|
|
278
|
-
expect.objectContaining({
|
|
279
|
-
handlerType: 'integration',
|
|
280
|
-
handler: '@test/local',
|
|
281
|
-
audience: 'internal',
|
|
282
|
-
status: 'filed',
|
|
283
|
-
message: 'General',
|
|
284
|
-
}),
|
|
285
|
-
]);
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
it('all integration handlers run in config order', async () => {
|
|
289
|
-
addIntegration({
|
|
290
|
-
name: '@test/first',
|
|
291
|
-
audience: 'internal',
|
|
292
|
-
handleBody: "return {status: 'filed', message: 'first'};",
|
|
293
|
-
});
|
|
294
|
-
addIntegration({
|
|
295
|
-
name: '@test/second',
|
|
296
|
-
audience: 'internal',
|
|
297
|
-
handleBody: "return {status: 'filed', message: 'second'};",
|
|
298
|
-
});
|
|
299
|
-
addIntegration({
|
|
300
|
-
name: '@test/third',
|
|
301
|
-
audience: 'internal',
|
|
302
|
-
handleBody: "return {status: 'filed', message: 'third'};",
|
|
303
|
-
});
|
|
304
|
-
configure(['@test/first', '@test/second', '@test/third']);
|
|
305
|
-
|
|
306
|
-
const result = await gapReport('General', {
|
|
307
|
-
...reportOptions,
|
|
308
|
-
cwd: projectDir,
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
expect(result.data.deliveries).toHaveLength(3);
|
|
312
|
-
expect(result.data.deliveries.map(d => d.handler)).toEqual([
|
|
313
|
-
'@test/first',
|
|
314
|
-
'@test/second',
|
|
315
|
-
'@test/third',
|
|
316
|
-
]);
|
|
317
|
-
expect(result.data.deliveries.map(d => d.message)).toEqual([
|
|
318
|
-
'first',
|
|
319
|
-
'second',
|
|
320
|
-
'third',
|
|
321
|
-
]);
|
|
322
|
-
expect(result.data.filedCount).toBe(3);
|
|
323
|
-
expect(result.data.status).toBe('filed');
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
it('deduplicates handlers by handle function identity', async () => {
|
|
327
|
-
// Create two integrations that share the same handle function
|
|
328
|
-
const sharedDir = path.join(projectDir, 'shared-handler');
|
|
329
|
-
fs.mkdirSync(sharedDir, {recursive: true});
|
|
330
|
-
fs.writeFileSync(
|
|
331
|
-
path.join(sharedDir, 'handler.mjs'),
|
|
332
|
-
"export const handle = async (report) => ({status: 'filed', message: 'shared'});\n",
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
const dir1 = packageDir('@test/first');
|
|
336
|
-
fs.mkdirSync(dir1, {recursive: true});
|
|
337
|
-
fs.writeFileSync(
|
|
338
|
-
path.join(dir1, 'package.json'),
|
|
339
|
-
JSON.stringify({name: '@test/first', version: '1.0.0'}),
|
|
340
|
-
);
|
|
341
|
-
fs.writeFileSync(
|
|
342
|
-
path.join(dir1, 'astryx.integration.mjs'),
|
|
343
|
-
`import {handle} from ${JSON.stringify(path.join(sharedDir, 'handler.mjs'))};\nexport const gapReport = {audience: 'internal', handle};\nexport default {};\n`,
|
|
344
|
-
);
|
|
345
|
-
|
|
346
|
-
const dir2 = packageDir('@test/second');
|
|
347
|
-
fs.mkdirSync(dir2, {recursive: true});
|
|
348
|
-
fs.writeFileSync(
|
|
349
|
-
path.join(dir2, 'package.json'),
|
|
350
|
-
JSON.stringify({name: '@test/second', version: '1.0.0'}),
|
|
351
|
-
);
|
|
352
|
-
fs.writeFileSync(
|
|
353
|
-
path.join(dir2, 'astryx.integration.mjs'),
|
|
354
|
-
`import {handle} from ${JSON.stringify(path.join(sharedDir, 'handler.mjs'))};\nexport const gapReport = {audience: 'internal', handle};\nexport default {};\n`,
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
configure(['@test/first', '@test/second']);
|
|
358
|
-
|
|
359
|
-
const result = await gapReport('General', {
|
|
360
|
-
...reportOptions,
|
|
361
|
-
cwd: projectDir,
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
expect(result.data.deliveries).toHaveLength(1);
|
|
365
|
-
expect(result.data.deliveries[0].message).toBe('shared');
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it('deduplicates the same handle across project and integration', () => {
|
|
369
|
-
const handle = async () => ({status: 'filed', message: 'shared'});
|
|
370
|
-
const entries = collectGapReportHandlers(
|
|
371
|
-
/** @type {any} */ ({
|
|
372
|
-
config: {gapReport: {audience: 'internal', handle}},
|
|
373
|
-
configPath: '/tmp/astryx.config.mjs',
|
|
374
|
-
loadedIntegrations: [
|
|
375
|
-
{
|
|
376
|
-
name: '@test/shared',
|
|
377
|
-
__manifestFile: '/tmp/astryx.integration.mjs',
|
|
378
|
-
__gapReport: {audience: 'internal', handle},
|
|
379
|
-
},
|
|
380
|
-
],
|
|
381
|
-
}),
|
|
382
|
-
);
|
|
383
|
-
|
|
384
|
-
expect(entries).toHaveLength(1);
|
|
385
|
-
expect(entries[0]).toMatchObject({
|
|
386
|
-
kind: 'handler',
|
|
387
|
-
handlerType: 'project',
|
|
388
|
-
handlerName: 'project',
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
it('each handler receives a fresh structuredClone', async () => {
|
|
393
|
-
addIntegration({
|
|
394
|
-
name: '@test/mutator',
|
|
395
|
-
audience: 'internal',
|
|
396
|
-
handleBody:
|
|
397
|
-
"report.component = 'MUTATED'; return {status: 'filed', message: report.component};",
|
|
398
|
-
});
|
|
399
|
-
addIntegration({
|
|
400
|
-
name: '@test/reader',
|
|
401
|
-
audience: 'internal',
|
|
402
|
-
handleBody: "return {status: 'filed', message: report.component};",
|
|
403
|
-
});
|
|
404
|
-
configure(['@test/mutator', '@test/reader']);
|
|
405
|
-
|
|
406
|
-
const result = await gapReport('General', {
|
|
407
|
-
...reportOptions,
|
|
408
|
-
cwd: projectDir,
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
412
|
-
expect(result.data.deliveries[0].message).toBe('MUTATED');
|
|
413
|
-
expect(result.data.deliveries[1].message).toBe('General');
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
it('repeated Project.load does not duplicate handlers', async () => {
|
|
417
|
-
addIntegration({
|
|
418
|
-
name: '@test/only',
|
|
419
|
-
audience: 'internal',
|
|
420
|
-
handleBody: "return {status: 'filed', message: 'once'};",
|
|
421
|
-
});
|
|
422
|
-
configure(['@test/only']);
|
|
423
|
-
|
|
424
|
-
// Call twice — second load should not add duplicates
|
|
425
|
-
const result1 = await gapReport('General', {
|
|
426
|
-
...reportOptions,
|
|
427
|
-
cwd: projectDir,
|
|
428
|
-
});
|
|
429
|
-
const result2 = await gapReport('General', {
|
|
430
|
-
...reportOptions,
|
|
431
|
-
cwd: projectDir,
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
expect(result1.data.deliveries).toHaveLength(1);
|
|
435
|
-
expect(result2.data.deliveries).toHaveLength(1);
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
it('does not treat inheritDebug as a gap-report opt-out', async () => {
|
|
439
|
-
fs.writeFileSync(
|
|
440
|
-
path.join(projectDir, 'package.json'),
|
|
441
|
-
JSON.stringify({name: 'fixture-app', astryx: {inheritDebug: false}}),
|
|
442
|
-
);
|
|
443
|
-
addIntegration({
|
|
444
|
-
name: '@test/always',
|
|
445
|
-
audience: 'internal',
|
|
446
|
-
handleBody: "return {status: 'filed', message: 'still ran'};",
|
|
447
|
-
});
|
|
448
|
-
configure(['@test/always']);
|
|
449
|
-
|
|
450
|
-
const result = await gapReport('General', {
|
|
451
|
-
...reportOptions,
|
|
452
|
-
cwd: projectDir,
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
expect(result.data.deliveries).toHaveLength(1);
|
|
456
|
-
expect(result.data.deliveries[0]).toMatchObject({
|
|
457
|
-
handler: '@test/always',
|
|
458
|
-
status: 'filed',
|
|
459
|
-
});
|
|
460
|
-
});
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
describe('gapReport handler isolation', () => {
|
|
464
|
-
it('terminates one timed-out handler and then runs the next handler', async () => {
|
|
465
|
-
addIntegration({
|
|
466
|
-
name: '@test/slow',
|
|
467
|
-
audience: 'internal',
|
|
468
|
-
handleBody: 'return new Promise(() => {});',
|
|
469
|
-
});
|
|
470
|
-
addIntegration({
|
|
471
|
-
name: '@test/after',
|
|
472
|
-
audience: 'internal',
|
|
473
|
-
handleBody: "return {status: 'filed', message: 'after'};",
|
|
474
|
-
});
|
|
475
|
-
configure(['@test/slow', '@test/after']);
|
|
476
|
-
const project = await Project.load(projectDir);
|
|
477
|
-
|
|
478
|
-
const deliveries = await deliverGapReportHandlers(
|
|
479
|
-
collectGapReportHandlers(project),
|
|
480
|
-
/** @type {any} */ ({component: 'Button'}),
|
|
481
|
-
{timeoutMs: 200},
|
|
482
|
-
);
|
|
483
|
-
|
|
484
|
-
expect(deliveries).toEqual([
|
|
485
|
-
{
|
|
486
|
-
handlerType: 'integration',
|
|
487
|
-
handler: '@test/slow',
|
|
488
|
-
audience: 'internal',
|
|
489
|
-
status: 'failed',
|
|
490
|
-
url: null,
|
|
491
|
-
message: 'Gap report handler timed out.',
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
handlerType: 'integration',
|
|
495
|
-
handler: '@test/after',
|
|
496
|
-
audience: 'internal',
|
|
497
|
-
status: 'filed',
|
|
498
|
-
url: null,
|
|
499
|
-
message: 'after',
|
|
500
|
-
},
|
|
501
|
-
]);
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
it('a timed-out late process.exit cannot terminate the caller', () => {
|
|
505
|
-
addIntegration({
|
|
506
|
-
name: '@test/late-exit',
|
|
507
|
-
audience: 'internal',
|
|
508
|
-
handleBody:
|
|
509
|
-
'await new Promise(resolve => setTimeout(resolve, 210)); process.exit(42);',
|
|
510
|
-
});
|
|
511
|
-
addIntegration({
|
|
512
|
-
name: '@test/after-late-exit',
|
|
513
|
-
audience: 'internal',
|
|
514
|
-
handleBody: "return {status: 'filed', message: 'survived'};",
|
|
515
|
-
});
|
|
516
|
-
configure(['@test/late-exit', '@test/after-late-exit']);
|
|
517
|
-
|
|
518
|
-
const projectModule = path.resolve(
|
|
519
|
-
import.meta.dirname,
|
|
520
|
-
'../../foundation/config/project.mjs',
|
|
521
|
-
);
|
|
522
|
-
const gapModule = path.resolve(import.meta.dirname, 'gap-report.mjs');
|
|
523
|
-
const source = `
|
|
524
|
-
const {Project} = await import(${JSON.stringify(projectModule)});
|
|
525
|
-
const {collectGapReportHandlers, deliverGapReportHandlers} = await import(${JSON.stringify(gapModule)});
|
|
526
|
-
const project = await Project.load(${JSON.stringify(projectDir)});
|
|
527
|
-
const deliveries = await deliverGapReportHandlers(
|
|
528
|
-
collectGapReportHandlers(project),
|
|
529
|
-
{component: 'Button'},
|
|
530
|
-
{timeoutMs: 200},
|
|
531
|
-
);
|
|
532
|
-
await new Promise(resolve => setTimeout(resolve, 300));
|
|
533
|
-
process.stdout.write(JSON.stringify(deliveries));
|
|
534
|
-
`;
|
|
535
|
-
const child = spawnSync(
|
|
536
|
-
process.execPath,
|
|
537
|
-
['--input-type=module', '-e', source],
|
|
538
|
-
{encoding: 'utf8', timeout: 5000},
|
|
539
|
-
);
|
|
540
|
-
|
|
541
|
-
expect(child.status, child.stderr).toBe(0);
|
|
542
|
-
expect(JSON.parse(child.stdout)).toMatchObject([
|
|
543
|
-
{handler: '@test/late-exit', status: 'failed'},
|
|
544
|
-
{handler: '@test/after-late-exit', status: 'filed'},
|
|
545
|
-
]);
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
it('redirects handler stdout and restores the parent stream method', async () => {
|
|
549
|
-
fs.writeFileSync(
|
|
550
|
-
path.join(projectDir, 'astryx.config.mjs'),
|
|
551
|
-
`export default {
|
|
552
|
-
gapReport: {
|
|
553
|
-
audience: 'internal',
|
|
554
|
-
handle() {
|
|
555
|
-
process.stdout.write('handler-noise');
|
|
556
|
-
return {status: 'skipped'};
|
|
557
|
-
},
|
|
558
|
-
},
|
|
559
|
-
};\n`,
|
|
560
|
-
);
|
|
561
|
-
const project = await Project.load(projectDir);
|
|
562
|
-
const stderrWrite = vi
|
|
563
|
-
.spyOn(process.stderr, 'write')
|
|
564
|
-
.mockImplementation(() => true);
|
|
565
|
-
const stdoutBefore = process.stdout.write;
|
|
566
|
-
try {
|
|
567
|
-
const deliveries = await deliverGapReportHandlers(
|
|
568
|
-
collectGapReportHandlers(project),
|
|
569
|
-
/** @type {any} */ ({component: 'Button'}),
|
|
570
|
-
);
|
|
571
|
-
|
|
572
|
-
expect(deliveries[0].status).toBe('skipped');
|
|
573
|
-
expect(
|
|
574
|
-
stderrWrite.mock.calls.map(call => String(call[0])).join(''),
|
|
575
|
-
).toContain('handler-noise');
|
|
576
|
-
expect(process.stdout.write).toBe(stdoutBefore);
|
|
577
|
-
} finally {
|
|
578
|
-
stderrWrite.mockRestore();
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
it('later handlers run after one throws', async () => {
|
|
583
|
-
addIntegration({
|
|
584
|
-
name: '@test/thrower',
|
|
585
|
-
audience: 'internal',
|
|
586
|
-
handleBody: "throw new Error('handler exploded');",
|
|
587
|
-
});
|
|
588
|
-
addIntegration({
|
|
589
|
-
name: '@test/survivor',
|
|
590
|
-
audience: 'internal',
|
|
591
|
-
handleBody: "return {status: 'filed', message: 'survived'};",
|
|
592
|
-
});
|
|
593
|
-
configure(['@test/thrower', '@test/survivor']);
|
|
594
|
-
|
|
595
|
-
const result = await gapReport('General', {
|
|
596
|
-
...reportOptions,
|
|
597
|
-
cwd: projectDir,
|
|
598
|
-
});
|
|
599
|
-
|
|
600
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
601
|
-
expect(result.data.deliveries[0].status).toBe('failed');
|
|
602
|
-
expect(result.data.deliveries[0].message).toContain('handler exploded');
|
|
603
|
-
expect(result.data.deliveries[1].status).toBe('filed');
|
|
604
|
-
expect(result.data.deliveries[1].message).toBe('survived');
|
|
605
|
-
expect(result.data.status).toBe('partial');
|
|
606
|
-
});
|
|
607
|
-
|
|
608
|
-
it('later handlers run after one tries process.exit', async () => {
|
|
609
|
-
addIntegration({
|
|
610
|
-
name: '@test/exiter',
|
|
611
|
-
audience: 'internal',
|
|
612
|
-
handleBody: 'process.exit(42);',
|
|
613
|
-
});
|
|
614
|
-
addIntegration({
|
|
615
|
-
name: '@test/survivor',
|
|
616
|
-
audience: 'internal',
|
|
617
|
-
handleBody: "return {status: 'filed', message: 'still here'};",
|
|
618
|
-
});
|
|
619
|
-
configure(['@test/exiter', '@test/survivor']);
|
|
620
|
-
|
|
621
|
-
const result = await gapReport('General', {
|
|
622
|
-
...reportOptions,
|
|
623
|
-
cwd: projectDir,
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
627
|
-
expect(result.data.deliveries[0].status).toBe('failed');
|
|
628
|
-
expect(result.data.deliveries[0].message).toContain('process.exit');
|
|
629
|
-
expect(result.data.deliveries[1].status).toBe('filed');
|
|
630
|
-
expect(result.data.filedCount).toBe(1);
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
it('later handlers run after one changes process.exitCode', async () => {
|
|
634
|
-
addIntegration({
|
|
635
|
-
name: '@test/exit-code',
|
|
636
|
-
audience: 'internal',
|
|
637
|
-
handleBody:
|
|
638
|
-
"process.exitCode = 42; return {status: 'filed', message: 'wrong'};",
|
|
639
|
-
});
|
|
640
|
-
addIntegration({
|
|
641
|
-
name: '@test/survivor',
|
|
642
|
-
audience: 'internal',
|
|
643
|
-
handleBody: "return {status: 'filed', message: 'still here'};",
|
|
644
|
-
});
|
|
645
|
-
configure(['@test/exit-code', '@test/survivor']);
|
|
646
|
-
const before = process.exitCode;
|
|
647
|
-
|
|
648
|
-
const result = await gapReport('General', {
|
|
649
|
-
...reportOptions,
|
|
650
|
-
cwd: projectDir,
|
|
651
|
-
});
|
|
652
|
-
|
|
653
|
-
expect(process.exitCode).toBe(before);
|
|
654
|
-
expect(result.data.deliveries[0]).toMatchObject({
|
|
655
|
-
handler: '@test/exit-code',
|
|
656
|
-
status: 'failed',
|
|
657
|
-
message: 'Handler changed process.exitCode.',
|
|
658
|
-
});
|
|
659
|
-
expect(result.data.deliveries[1]).toMatchObject({
|
|
660
|
-
handler: '@test/survivor',
|
|
661
|
-
status: 'filed',
|
|
662
|
-
});
|
|
663
|
-
});
|
|
664
|
-
|
|
665
|
-
it('handler that returns non-receipt is a failed delivery', async () => {
|
|
666
|
-
addIntegration({
|
|
667
|
-
name: '@test/non-receipt',
|
|
668
|
-
audience: 'internal',
|
|
669
|
-
handleBody: "return 'not an object';",
|
|
670
|
-
});
|
|
671
|
-
addIntegration({
|
|
672
|
-
name: '@test/after',
|
|
673
|
-
audience: 'internal',
|
|
674
|
-
handleBody: "return {status: 'filed', message: 'still ok'};",
|
|
675
|
-
});
|
|
676
|
-
configure(['@test/non-receipt', '@test/after']);
|
|
677
|
-
|
|
678
|
-
const result = await gapReport('General', {
|
|
679
|
-
...reportOptions,
|
|
680
|
-
cwd: projectDir,
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
684
|
-
expect(result.data.deliveries[0].status).toBe('failed');
|
|
685
|
-
expect(result.data.deliveries[1].status).toBe('filed');
|
|
686
|
-
});
|
|
687
|
-
|
|
688
|
-
it('malformed integration handler is isolated as a failed delivery', async () => {
|
|
689
|
-
const dir = packageDir('@test/malformed');
|
|
690
|
-
fs.mkdirSync(dir, {recursive: true});
|
|
691
|
-
fs.writeFileSync(
|
|
692
|
-
path.join(dir, 'package.json'),
|
|
693
|
-
JSON.stringify({name: '@test/malformed', version: '1.0.0'}),
|
|
694
|
-
);
|
|
695
|
-
fs.writeFileSync(
|
|
696
|
-
path.join(dir, 'astryx.integration.mjs'),
|
|
697
|
-
"export const gapReport = {audience: 'internal', command: './writer.mjs'};\nexport default {};\n",
|
|
698
|
-
);
|
|
699
|
-
|
|
700
|
-
addIntegration({
|
|
701
|
-
name: '@test/valid',
|
|
702
|
-
audience: 'internal',
|
|
703
|
-
handleBody: "return {status: 'filed', message: 'ok'};",
|
|
704
|
-
});
|
|
705
|
-
configure(['@test/malformed', '@test/valid']);
|
|
706
|
-
|
|
707
|
-
const result = await gapReport('General', {
|
|
708
|
-
...reportOptions,
|
|
709
|
-
cwd: projectDir,
|
|
710
|
-
});
|
|
711
|
-
|
|
712
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
713
|
-
expect(result.data.deliveries.map(d => d.handler)).toEqual([
|
|
714
|
-
'@test/malformed',
|
|
715
|
-
'@test/valid',
|
|
716
|
-
]);
|
|
717
|
-
expect(result.data.deliveries[0].status).toBe('failed');
|
|
718
|
-
expect(result.data.deliveries[1]).toMatchObject({
|
|
719
|
-
status: 'filed',
|
|
720
|
-
message: 'ok',
|
|
721
|
-
});
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
it('an integration that fails to load is a failed delivery, not a missing handler', async () => {
|
|
725
|
-
addBrokenIntegration('@test/broken');
|
|
726
|
-
configure(['@test/broken'], {
|
|
727
|
-
issuesUrl: 'https://github.com/acme/core/issues/new',
|
|
728
|
-
});
|
|
729
|
-
|
|
730
|
-
const result = await gapReport('General', {
|
|
731
|
-
...reportOptions,
|
|
732
|
-
cwd: projectDir,
|
|
733
|
-
});
|
|
734
|
-
|
|
735
|
-
expect(result.data.status).toBe('failed');
|
|
736
|
-
expect(result.data.deliveries).toEqual([
|
|
737
|
-
{
|
|
738
|
-
handlerType: 'integration',
|
|
739
|
-
handler: '@test/broken',
|
|
740
|
-
audience: null,
|
|
741
|
-
status: 'failed',
|
|
742
|
-
url: null,
|
|
743
|
-
message: expect.stringContaining(
|
|
744
|
-
'intentional integration load failure',
|
|
745
|
-
),
|
|
746
|
-
},
|
|
747
|
-
]);
|
|
748
|
-
});
|
|
749
|
-
|
|
750
|
-
it('an integration that fails to load keeps the public fallback off, even with consent', async () => {
|
|
751
|
-
addBrokenIntegration('@test/broken');
|
|
752
|
-
configure(['@test/broken'], {
|
|
753
|
-
issuesUrl: 'https://github.com/acme/core/issues/new',
|
|
754
|
-
});
|
|
755
|
-
const argsFile = stubGh();
|
|
756
|
-
|
|
757
|
-
const result = await gapReport('General', {
|
|
758
|
-
...reportOptions,
|
|
759
|
-
confirmPublic: true,
|
|
760
|
-
cwd: projectDir,
|
|
761
|
-
});
|
|
762
|
-
|
|
763
|
-
expect(result.data.status).toBe('failed');
|
|
764
|
-
expect(result.data.deliveries.map(d => d.handlerType)).toEqual([
|
|
765
|
-
'integration',
|
|
766
|
-
]);
|
|
767
|
-
expect(fs.existsSync(argsFile)).toBe(false);
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
it('an integration that fails to load keeps its place beside working handlers', async () => {
|
|
771
|
-
addBrokenIntegration('@test/broken');
|
|
772
|
-
addIntegration({
|
|
773
|
-
name: '@test/valid',
|
|
774
|
-
audience: 'internal',
|
|
775
|
-
handleBody: "return {status: 'filed', message: 'ok'};",
|
|
776
|
-
});
|
|
777
|
-
configure(['@test/broken', '@test/valid']);
|
|
778
|
-
|
|
779
|
-
const result = await gapReport('General', {
|
|
780
|
-
...reportOptions,
|
|
781
|
-
cwd: projectDir,
|
|
782
|
-
});
|
|
783
|
-
|
|
784
|
-
expect(result.data.status).toBe('partial');
|
|
785
|
-
expect(result.data.deliveries.map(d => [d.handler, d.status])).toEqual([
|
|
786
|
-
['@test/broken', 'failed'],
|
|
787
|
-
['@test/valid', 'filed'],
|
|
788
|
-
]);
|
|
789
|
-
});
|
|
790
|
-
|
|
791
|
-
it('invalid handler receipt is recorded as failed delivery', async () => {
|
|
792
|
-
addIntegration({
|
|
793
|
-
name: '@test/bad-receipt',
|
|
794
|
-
audience: 'internal',
|
|
795
|
-
handleBody: "return {status: 'invalid_status'};",
|
|
796
|
-
});
|
|
797
|
-
addIntegration({
|
|
798
|
-
name: '@test/good',
|
|
799
|
-
audience: 'internal',
|
|
800
|
-
handleBody: "return {status: 'filed', message: 'good'};",
|
|
801
|
-
});
|
|
802
|
-
configure(['@test/bad-receipt', '@test/good']);
|
|
803
|
-
|
|
804
|
-
const result = await gapReport('General', {
|
|
805
|
-
...reportOptions,
|
|
806
|
-
cwd: projectDir,
|
|
807
|
-
});
|
|
808
|
-
|
|
809
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
810
|
-
expect(result.data.deliveries[0].status).toBe('failed');
|
|
811
|
-
expect(result.data.deliveries[0].message).toContain('invalid receipt');
|
|
812
|
-
expect(result.data.deliveries[1].status).toBe('filed');
|
|
813
|
-
});
|
|
814
|
-
});
|
|
815
|
-
|
|
816
|
-
describe('gapReport per-handler consent', () => {
|
|
817
|
-
it('gates a public project handler until consent is explicit', async () => {
|
|
818
|
-
const marker = path.join(projectDir, 'project-handler-ran');
|
|
819
|
-
fs.writeFileSync(
|
|
820
|
-
path.join(projectDir, 'astryx.config.mjs'),
|
|
821
|
-
`import * as fs from 'node:fs';
|
|
822
|
-
export default {
|
|
823
|
-
gapReport: {
|
|
824
|
-
audience: 'public',
|
|
825
|
-
handle() {
|
|
826
|
-
fs.writeFileSync(${JSON.stringify(marker)}, 'yes');
|
|
827
|
-
return {status: 'filed', message: 'project filed'};
|
|
828
|
-
},
|
|
829
|
-
},
|
|
830
|
-
};\n`,
|
|
831
|
-
);
|
|
832
|
-
|
|
833
|
-
const pending = await gapReport('General', {
|
|
834
|
-
...reportOptions,
|
|
835
|
-
cwd: projectDir,
|
|
836
|
-
});
|
|
837
|
-
expect(pending.data.deliveries[0]).toMatchObject({
|
|
838
|
-
handlerType: 'project',
|
|
839
|
-
handler: 'project',
|
|
840
|
-
audience: 'public',
|
|
841
|
-
status: 'consent_required',
|
|
842
|
-
});
|
|
843
|
-
expect(fs.existsSync(marker)).toBe(false);
|
|
844
|
-
|
|
845
|
-
const filed = await gapReport('General', {
|
|
846
|
-
...reportOptions,
|
|
847
|
-
confirmPublic: true,
|
|
848
|
-
cwd: projectDir,
|
|
849
|
-
});
|
|
850
|
-
expect(filed.data.deliveries[0]).toMatchObject({
|
|
851
|
-
handlerType: 'project',
|
|
852
|
-
handler: 'project',
|
|
853
|
-
audience: 'public',
|
|
854
|
-
status: 'filed',
|
|
855
|
-
});
|
|
856
|
-
expect(fs.readFileSync(marker, 'utf8')).toBe('yes');
|
|
857
|
-
});
|
|
858
|
-
|
|
859
|
-
it('public handler is skipped while internal handler runs', async () => {
|
|
860
|
-
addIntegration({
|
|
861
|
-
name: '@test/public-one',
|
|
862
|
-
audience: 'public',
|
|
863
|
-
handleBody: "return {status: 'filed', message: 'public filed'};",
|
|
864
|
-
});
|
|
865
|
-
addIntegration({
|
|
866
|
-
name: '@test/internal-one',
|
|
867
|
-
audience: 'internal',
|
|
868
|
-
handleBody: "return {status: 'filed', message: 'internal filed'};",
|
|
869
|
-
});
|
|
870
|
-
configure(['@test/public-one', '@test/internal-one']);
|
|
871
|
-
|
|
872
|
-
const result = await gapReport('General', {
|
|
873
|
-
...reportOptions,
|
|
874
|
-
cwd: projectDir,
|
|
875
|
-
});
|
|
876
|
-
|
|
877
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
878
|
-
expect(result.data.deliveries[0].status).toBe('consent_required');
|
|
879
|
-
expect(result.data.deliveries[0].message).toBe(PUBLIC_CONFIRMATION_MESSAGE);
|
|
880
|
-
expect(result.data.deliveries[1].status).toBe('filed');
|
|
881
|
-
expect(result.data.deliveries[1].message).toBe('internal filed');
|
|
882
|
-
expect(result.data.filedCount).toBe(1);
|
|
883
|
-
});
|
|
884
|
-
|
|
885
|
-
it('multiple internal handlers all run without consent', async () => {
|
|
886
|
-
addIntegration({
|
|
887
|
-
name: '@test/internal-a',
|
|
888
|
-
audience: 'internal',
|
|
889
|
-
handleBody: "return {status: 'filed', message: 'a'};",
|
|
890
|
-
});
|
|
891
|
-
addIntegration({
|
|
892
|
-
name: '@test/internal-b',
|
|
893
|
-
audience: 'internal',
|
|
894
|
-
handleBody: "return {status: 'filed', message: 'b'};",
|
|
895
|
-
});
|
|
896
|
-
configure(['@test/internal-a', '@test/internal-b']);
|
|
897
|
-
|
|
898
|
-
const result = await gapReport('General', {
|
|
899
|
-
...reportOptions,
|
|
900
|
-
cwd: projectDir,
|
|
901
|
-
});
|
|
902
|
-
|
|
903
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
904
|
-
expect(result.data.deliveries.every(d => d.status === 'filed')).toBe(true);
|
|
905
|
-
expect(result.data.filedCount).toBe(2);
|
|
906
|
-
expect(result.data.status).toBe('filed');
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
it('public handler runs when confirmPublic is true', async () => {
|
|
910
|
-
addIntegration({
|
|
911
|
-
name: '@test/public-ok',
|
|
912
|
-
audience: 'public',
|
|
913
|
-
handleBody: "return {status: 'filed', message: 'public worked'};",
|
|
914
|
-
});
|
|
915
|
-
configure(['@test/public-ok']);
|
|
916
|
-
|
|
917
|
-
const result = await gapReport('General', {
|
|
918
|
-
...reportOptions,
|
|
919
|
-
confirmPublic: true,
|
|
920
|
-
cwd: projectDir,
|
|
921
|
-
});
|
|
922
|
-
|
|
923
|
-
expect(result.data.deliveries).toHaveLength(1);
|
|
924
|
-
expect(result.data.deliveries[0].status).toBe('filed');
|
|
925
|
-
expect(result.data.deliveries[0].message).toBe('public worked');
|
|
926
|
-
});
|
|
927
|
-
});
|
|
928
|
-
|
|
929
|
-
describe('gapReport fallback behavior', () => {
|
|
930
|
-
it('handlers suppress the built-in fallback', async () => {
|
|
931
|
-
addIntegration({
|
|
932
|
-
name: '@test/has-handler',
|
|
933
|
-
audience: 'internal',
|
|
934
|
-
issuesUrl: 'https://github.com/acme/widgets/issues',
|
|
935
|
-
handleBody: "return {status: 'filed', message: 'handler took it'};",
|
|
936
|
-
});
|
|
937
|
-
configure(['@test/has-handler'], {
|
|
938
|
-
issuesUrl: 'https://github.com/acme/core/issues',
|
|
939
|
-
});
|
|
940
|
-
|
|
941
|
-
const result = await gapReport('General', {
|
|
942
|
-
...reportOptions,
|
|
943
|
-
cwd: projectDir,
|
|
944
|
-
});
|
|
945
|
-
|
|
946
|
-
// Should use handler, not GitHub fallback
|
|
947
|
-
expect(result.data.deliveries).toHaveLength(1);
|
|
948
|
-
expect(result.data.deliveries[0].message).toBe('handler took it');
|
|
949
|
-
});
|
|
950
|
-
|
|
951
|
-
it('no-handler GitHub consent-gated fallback works', async () => {
|
|
952
|
-
configure([], {issuesUrl: 'https://github.com/acme/widgets/issues/new'});
|
|
953
|
-
const binDir = path.join(projectDir, 'bin');
|
|
954
|
-
const argsFile = path.join(projectDir, 'gh-args.json');
|
|
955
|
-
fs.mkdirSync(binDir, {recursive: true});
|
|
956
|
-
fs.writeFileSync(
|
|
957
|
-
path.join(binDir, 'gh'),
|
|
958
|
-
`#!/usr/bin/env node
|
|
959
|
-
import fs from 'node:fs';
|
|
960
|
-
fs.writeFileSync(${JSON.stringify(argsFile)}, JSON.stringify(process.argv.slice(2)));
|
|
961
|
-
console.log('https://github.com/acme/widgets/issues/42');
|
|
962
|
-
`,
|
|
963
|
-
{mode: 0o755},
|
|
964
|
-
);
|
|
965
|
-
fs.chmodSync(path.join(binDir, 'gh'), 0o755);
|
|
966
|
-
vi.stubEnv('PATH', `${binDir}${path.delimiter}${process.env.PATH ?? ''}`);
|
|
967
|
-
|
|
968
|
-
// Without consent
|
|
969
|
-
const pending = await gapReport('Button', {
|
|
970
|
-
...reportOptions,
|
|
971
|
-
cwd: projectDir,
|
|
972
|
-
});
|
|
973
|
-
expect(pending.data.deliveries[0].status).toBe('consent_required');
|
|
974
|
-
expect(fs.existsSync(argsFile)).toBe(false);
|
|
975
|
-
|
|
976
|
-
// With consent
|
|
977
|
-
const filed = await gapReport('Button', {
|
|
978
|
-
...reportOptions,
|
|
979
|
-
confirmPublic: true,
|
|
980
|
-
cwd: projectDir,
|
|
981
|
-
});
|
|
982
|
-
expect(filed.data.deliveries[0].status).toBe('filed');
|
|
983
|
-
expect(filed.data.status).toBe('filed');
|
|
984
|
-
});
|
|
985
|
-
|
|
986
|
-
it('no-handler non-GitHub route returns routed_only', async () => {
|
|
987
|
-
configure([], {issuesUrl: 'https://tracker.example/new'});
|
|
988
|
-
|
|
989
|
-
const result = await gapReport('Button', {
|
|
990
|
-
...reportOptions,
|
|
991
|
-
confirmPublic: true,
|
|
992
|
-
cwd: projectDir,
|
|
993
|
-
});
|
|
994
|
-
|
|
995
|
-
expect(result.data.deliveries[0].status).toBe('routed_only');
|
|
996
|
-
expect(result.data.deliveries[0].url).toBe('https://tracker.example/new');
|
|
997
|
-
expect(result.data.status).toBe('routed_only');
|
|
998
|
-
});
|
|
999
|
-
|
|
1000
|
-
it('no handler and no issues URL throws ERR_NOT_FOUND', async () => {
|
|
1001
|
-
// Create a project with an integration that has no handler, no issuesUrl,
|
|
1002
|
-
// and target an unknown package explicitly
|
|
1003
|
-
const name = '@test/bare';
|
|
1004
|
-
const dir = packageDir(name);
|
|
1005
|
-
fs.mkdirSync(dir, {recursive: true});
|
|
1006
|
-
fs.writeFileSync(
|
|
1007
|
-
path.join(dir, 'package.json'),
|
|
1008
|
-
JSON.stringify({name, version: '1.0.0'}),
|
|
1009
|
-
);
|
|
1010
|
-
fs.writeFileSync(
|
|
1011
|
-
path.join(dir, 'astryx.integration.mjs'),
|
|
1012
|
-
'export default {};\n',
|
|
1013
|
-
);
|
|
1014
|
-
configure([name]);
|
|
1015
|
-
|
|
1016
|
-
await expect(
|
|
1017
|
-
gapReport('Button', {
|
|
1018
|
-
...reportOptions,
|
|
1019
|
-
package: name,
|
|
1020
|
-
cwd: projectDir,
|
|
1021
|
-
}),
|
|
1022
|
-
).rejects.toMatchObject({code: 'ERR_NOT_FOUND'});
|
|
1023
|
-
});
|
|
1024
|
-
});
|
|
1025
|
-
|
|
1026
|
-
describe('gapReport destinations and --to', () => {
|
|
1027
|
-
/** A shared internal handler that records each call in a marker file. */
|
|
1028
|
-
function addSharedHandler() {
|
|
1029
|
-
const marker = path.join(projectDir, 'shared-called');
|
|
1030
|
-
addIntegration({
|
|
1031
|
-
name: '@test/shared',
|
|
1032
|
-
audience: 'internal',
|
|
1033
|
-
handleBody: `(await import('node:fs')).writeFileSync(${JSON.stringify(marker)}, 'x'); return {status: 'filed', message: 'shared'};`,
|
|
1034
|
-
});
|
|
1035
|
-
return marker;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
function addWidgets(issuesUrl = 'https://github.com/acme/widgets/issues') {
|
|
1039
|
-
addIntegration({name: '@test/widgets', handler: false, issuesUrl});
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
it('keeps the default route and lists the destinations with the ask line', async () => {
|
|
1043
|
-
const marker = addSharedHandler();
|
|
1044
|
-
addWidgets();
|
|
1045
|
-
configure(['@test/shared', '@test/widgets']);
|
|
1046
|
-
const argsFile = stubGh();
|
|
1047
|
-
|
|
1048
|
-
const result = await gapReport('General', {
|
|
1049
|
-
...reportOptions,
|
|
1050
|
-
confirmPublic: true,
|
|
1051
|
-
cwd: projectDir,
|
|
1052
|
-
});
|
|
1053
|
-
|
|
1054
|
-
expect(result.data.deliveries).toEqual([
|
|
1055
|
-
expect.objectContaining({handler: '@test/shared', status: 'filed'}),
|
|
1056
|
-
]);
|
|
1057
|
-
expect(fs.existsSync(marker)).toBe(true);
|
|
1058
|
-
expect(fs.existsSync(argsFile)).toBe(false);
|
|
1059
|
-
expect(result.data.destinations).toEqual([
|
|
1060
|
-
{to: null, default: true, issuesUrl: null},
|
|
1061
|
-
{
|
|
1062
|
-
to: '@test/widgets',
|
|
1063
|
-
default: false,
|
|
1064
|
-
issuesUrl: 'https://github.com/acme/widgets/issues',
|
|
1065
|
-
},
|
|
1066
|
-
]);
|
|
1067
|
-
expect(result.data.ask).toBe(ASK_DESTINATION_MESSAGE);
|
|
1068
|
-
expect(ASK_DESTINATION_MESSAGE).toMatch(/ask the person/i);
|
|
1069
|
-
});
|
|
1070
|
-
|
|
1071
|
-
it('lists no destinations when no integration names an issuesUrl', async () => {
|
|
1072
|
-
addSharedHandler();
|
|
1073
|
-
configure(['@test/shared']);
|
|
1074
|
-
|
|
1075
|
-
const result = await gapReport('General', {
|
|
1076
|
-
...reportOptions,
|
|
1077
|
-
cwd: projectDir,
|
|
1078
|
-
});
|
|
1079
|
-
|
|
1080
|
-
expect(result.data).not.toHaveProperty('destinations');
|
|
1081
|
-
expect(result.data).not.toHaveProperty('ask');
|
|
1082
|
-
});
|
|
1083
|
-
|
|
1084
|
-
it('files with the chosen integration GitHub issuesUrl only with consent, and runs no handler', async () => {
|
|
1085
|
-
const marker = addSharedHandler();
|
|
1086
|
-
addWidgets();
|
|
1087
|
-
configure(['@test/shared', '@test/widgets']);
|
|
1088
|
-
const argsFile = stubGh();
|
|
1089
|
-
|
|
1090
|
-
const pending = await gapReport('General', {
|
|
1091
|
-
...reportOptions,
|
|
1092
|
-
to: '@test/widgets',
|
|
1093
|
-
cwd: projectDir,
|
|
1094
|
-
});
|
|
1095
|
-
expect(pending.data.deliveries).toEqual([
|
|
1096
|
-
{
|
|
1097
|
-
handlerType: 'fallback',
|
|
1098
|
-
handler: 'github',
|
|
1099
|
-
audience: 'public',
|
|
1100
|
-
status: 'consent_required',
|
|
1101
|
-
url: null,
|
|
1102
|
-
message: PUBLIC_CONFIRMATION_MESSAGE,
|
|
1103
|
-
},
|
|
1104
|
-
]);
|
|
1105
|
-
expect(pending.data.issuesUrl).toBe(
|
|
1106
|
-
'https://github.com/acme/widgets/issues',
|
|
1107
|
-
);
|
|
1108
|
-
expect(pending.data).not.toHaveProperty('destinations');
|
|
1109
|
-
expect(fs.existsSync(argsFile)).toBe(false);
|
|
1110
|
-
|
|
1111
|
-
const filed = await gapReport('General', {
|
|
1112
|
-
...reportOptions,
|
|
1113
|
-
to: '@test/widgets',
|
|
1114
|
-
confirmPublic: true,
|
|
1115
|
-
cwd: projectDir,
|
|
1116
|
-
});
|
|
1117
|
-
expect(filed.data.deliveries).toHaveLength(1);
|
|
1118
|
-
expect(filed.data.deliveries[0]).toMatchObject({
|
|
1119
|
-
handlerType: 'fallback',
|
|
1120
|
-
handler: 'github',
|
|
1121
|
-
status: 'filed',
|
|
1122
|
-
});
|
|
1123
|
-
const args = JSON.parse(fs.readFileSync(argsFile, 'utf8'));
|
|
1124
|
-
expect(args.slice(0, 4)).toEqual([
|
|
1125
|
-
'issue',
|
|
1126
|
-
'create',
|
|
1127
|
-
'--repo',
|
|
1128
|
-
'acme/widgets',
|
|
1129
|
-
]);
|
|
1130
|
-
expect(fs.existsSync(marker)).toBe(false);
|
|
1131
|
-
});
|
|
1132
|
-
|
|
1133
|
-
it('routes a chosen non-GitHub issuesUrl as routed_only', async () => {
|
|
1134
|
-
addSharedHandler();
|
|
1135
|
-
addWidgets('https://tracker.example/widgets');
|
|
1136
|
-
configure(['@test/shared', '@test/widgets']);
|
|
1137
|
-
|
|
1138
|
-
const result = await gapReport('General', {
|
|
1139
|
-
...reportOptions,
|
|
1140
|
-
to: '@test/widgets',
|
|
1141
|
-
cwd: projectDir,
|
|
1142
|
-
});
|
|
1143
|
-
|
|
1144
|
-
expect(result.data.deliveries).toEqual([
|
|
1145
|
-
expect.objectContaining({
|
|
1146
|
-
handlerType: 'fallback',
|
|
1147
|
-
handler: 'issuesUrl',
|
|
1148
|
-
status: 'routed_only',
|
|
1149
|
-
url: 'https://tracker.example/widgets',
|
|
1150
|
-
}),
|
|
1151
|
-
]);
|
|
1152
|
-
expect(result.data.status).toBe('routed_only');
|
|
1153
|
-
});
|
|
1154
|
-
|
|
1155
|
-
it.each([
|
|
1156
|
-
['a package that is not loaded', '@test/nope'],
|
|
1157
|
-
['a loaded integration without an issuesUrl', '@test/shared'],
|
|
1158
|
-
])(
|
|
1159
|
-
'refuses --to naming %s, lists the choices, and sends nothing',
|
|
1160
|
-
async (_label, to) => {
|
|
1161
|
-
const marker = addSharedHandler();
|
|
1162
|
-
addWidgets();
|
|
1163
|
-
configure(['@test/shared', '@test/widgets']);
|
|
1164
|
-
|
|
1165
|
-
await expect(
|
|
1166
|
-
gapReport('General', {...reportOptions, to, cwd: projectDir}),
|
|
1167
|
-
).rejects.toMatchObject({
|
|
1168
|
-
code: 'ERR_UNKNOWN_PACKAGE',
|
|
1169
|
-
suggestions: [
|
|
1170
|
-
{
|
|
1171
|
-
name: '@test/widgets',
|
|
1172
|
-
reason: 'https://github.com/acme/widgets/issues',
|
|
1173
|
-
},
|
|
1174
|
-
],
|
|
1175
|
-
});
|
|
1176
|
-
expect(fs.existsSync(marker)).toBe(false);
|
|
1177
|
-
},
|
|
1178
|
-
);
|
|
1179
|
-
|
|
1180
|
-
it.each([
|
|
1181
|
-
['an empty value', ''],
|
|
1182
|
-
['a blank value', ' '],
|
|
1183
|
-
['an over-long value', `@test/${'a'.repeat(300)}`],
|
|
1184
|
-
])('refuses %s for --to with the destination list', async (_label, to) => {
|
|
1185
|
-
const marker = addSharedHandler();
|
|
1186
|
-
addWidgets();
|
|
1187
|
-
configure(['@test/shared', '@test/widgets']);
|
|
1188
|
-
|
|
1189
|
-
await expect(
|
|
1190
|
-
gapReport('General', {...reportOptions, to, cwd: projectDir}),
|
|
1191
|
-
).rejects.toMatchObject({
|
|
1192
|
-
code: 'ERR_UNKNOWN_PACKAGE',
|
|
1193
|
-
suggestions: [{name: '@test/widgets'}],
|
|
1194
|
-
});
|
|
1195
|
-
expect(fs.existsSync(marker)).toBe(false);
|
|
1196
|
-
});
|
|
1197
|
-
|
|
1198
|
-
it('treats to: null as absent', async () => {
|
|
1199
|
-
const marker = addSharedHandler();
|
|
1200
|
-
addWidgets();
|
|
1201
|
-
configure(['@test/shared', '@test/widgets']);
|
|
1202
|
-
|
|
1203
|
-
const result = await gapReport('General', {
|
|
1204
|
-
...reportOptions,
|
|
1205
|
-
to: /** @type {any} */ (null),
|
|
1206
|
-
cwd: projectDir,
|
|
1207
|
-
});
|
|
1208
|
-
|
|
1209
|
-
expect(result.data.deliveries).toHaveLength(1);
|
|
1210
|
-
expect(fs.existsSync(marker)).toBe(true);
|
|
1211
|
-
expect(result.data.destinations).toHaveLength(2);
|
|
1212
|
-
});
|
|
1213
|
-
|
|
1214
|
-
it('lists the destinations with the categories', async () => {
|
|
1215
|
-
addSharedHandler();
|
|
1216
|
-
addWidgets();
|
|
1217
|
-
configure(['@test/shared', '@test/widgets']);
|
|
1218
|
-
|
|
1219
|
-
const listed = await gapReport(undefined, {
|
|
1220
|
-
listCategories: true,
|
|
1221
|
-
cwd: projectDir,
|
|
1222
|
-
});
|
|
1223
|
-
|
|
1224
|
-
expect(listed.data).toEqual(GAP_REPORT_CATEGORIES);
|
|
1225
|
-
expect(listed.meta).toEqual({
|
|
1226
|
-
destinations: [
|
|
1227
|
-
{to: null, default: true, issuesUrl: null},
|
|
1228
|
-
{
|
|
1229
|
-
to: '@test/widgets',
|
|
1230
|
-
default: false,
|
|
1231
|
-
issuesUrl: 'https://github.com/acme/widgets/issues',
|
|
1232
|
-
},
|
|
1233
|
-
],
|
|
1234
|
-
ask: ASK_DESTINATION_MESSAGE,
|
|
1235
|
-
});
|
|
1236
|
-
});
|
|
1237
|
-
|
|
1238
|
-
it('adds no meta to the categories when there is only the default', async () => {
|
|
1239
|
-
configure([]);
|
|
1240
|
-
const listed = await gapReport(undefined, {
|
|
1241
|
-
listCategories: true,
|
|
1242
|
-
cwd: projectDir,
|
|
1243
|
-
});
|
|
1244
|
-
expect(listed).not.toHaveProperty('meta');
|
|
1245
|
-
});
|
|
1246
|
-
|
|
1247
|
-
it('refuses --to with --list-categories', async () => {
|
|
1248
|
-
await expect(
|
|
1249
|
-
gapReport(undefined, {
|
|
1250
|
-
listCategories: true,
|
|
1251
|
-
to: '@test/widgets',
|
|
1252
|
-
cwd: projectDir,
|
|
1253
|
-
}),
|
|
1254
|
-
).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
|
|
1255
|
-
});
|
|
1256
|
-
});
|
|
1257
|
-
|
|
1258
|
-
describe('gapReport target selection', () => {
|
|
1259
|
-
it('routes to the unique component owner', async () => {
|
|
1260
|
-
addIntegration({
|
|
1261
|
-
name: '@test/owner',
|
|
1262
|
-
audience: 'internal',
|
|
1263
|
-
component: 'TargetWidget',
|
|
1264
|
-
handleBody: "return {status: 'filed', message: report.target.package};",
|
|
1265
|
-
});
|
|
1266
|
-
configure(['@test/owner']);
|
|
1267
|
-
|
|
1268
|
-
const result = await gapReport('XDSTargetWidget', {
|
|
1269
|
-
...reportOptions,
|
|
1270
|
-
cwd: projectDir,
|
|
1271
|
-
});
|
|
1272
|
-
|
|
1273
|
-
expect(result.data.package).toBe('@test/owner');
|
|
1274
|
-
expect(result.data.deliveries[0].message).toBe('@test/owner');
|
|
1275
|
-
});
|
|
1276
|
-
|
|
1277
|
-
it('uses explicit package', async () => {
|
|
1278
|
-
addIntegration({
|
|
1279
|
-
name: '@test/first',
|
|
1280
|
-
audience: 'internal',
|
|
1281
|
-
handleBody: "return {status: 'filed', message: 'first'};",
|
|
1282
|
-
});
|
|
1283
|
-
addIntegration({
|
|
1284
|
-
name: '@test/second',
|
|
1285
|
-
audience: 'internal',
|
|
1286
|
-
handleBody: "return {status: 'filed', message: 'second'};",
|
|
1287
|
-
});
|
|
1288
|
-
configure(['@test/first', '@test/second']);
|
|
1289
|
-
|
|
1290
|
-
const result = await gapReport('General', {
|
|
1291
|
-
...reportOptions,
|
|
1292
|
-
package: '@test/second',
|
|
1293
|
-
cwd: projectDir,
|
|
1294
|
-
});
|
|
1295
|
-
|
|
1296
|
-
expect(result.data.package).toBe('@test/second');
|
|
1297
|
-
// Both handlers still run (fan-out)
|
|
1298
|
-
expect(result.data.deliveries).toHaveLength(2);
|
|
1299
|
-
});
|
|
1300
|
-
|
|
1301
|
-
it('falls back to Core when no component owner found', async () => {
|
|
1302
|
-
addIntegration({
|
|
1303
|
-
name: '@test/no-match',
|
|
1304
|
-
audience: 'internal',
|
|
1305
|
-
handleBody: "return {status: 'filed', message: report.target.package};",
|
|
1306
|
-
});
|
|
1307
|
-
configure(['@test/no-match']);
|
|
1308
|
-
|
|
1309
|
-
const result = await gapReport('General', {
|
|
1310
|
-
...reportOptions,
|
|
1311
|
-
cwd: projectDir,
|
|
1312
|
-
});
|
|
1313
|
-
|
|
1314
|
-
expect(result.data.package).toBe('@astryxdesign/core');
|
|
1315
|
-
});
|
|
1316
|
-
|
|
1317
|
-
it('requires --package when multiple packages own the component', async () => {
|
|
1318
|
-
addIntegration({
|
|
1319
|
-
name: '@test/first',
|
|
1320
|
-
component: 'SharedWidget',
|
|
1321
|
-
audience: 'internal',
|
|
1322
|
-
});
|
|
1323
|
-
addIntegration({
|
|
1324
|
-
name: '@test/second',
|
|
1325
|
-
component: 'SharedWidget',
|
|
1326
|
-
audience: 'internal',
|
|
1327
|
-
});
|
|
1328
|
-
configure(['@test/first', '@test/second']);
|
|
1329
|
-
|
|
1330
|
-
await expect(
|
|
1331
|
-
gapReport('SharedWidget', {...reportOptions, cwd: projectDir}),
|
|
1332
|
-
).rejects.toMatchObject({code: 'ERR_AMBIGUOUS_COMPONENT'});
|
|
1333
|
-
});
|
|
1334
|
-
});
|
|
1335
|
-
|
|
1336
|
-
describe('gapReport aggregate status and CLI exit', () => {
|
|
1337
|
-
it('all filed → status filed', async () => {
|
|
1338
|
-
addIntegration({
|
|
1339
|
-
name: '@test/a',
|
|
1340
|
-
audience: 'internal',
|
|
1341
|
-
handleBody: "return {status: 'filed', message: 'a'};",
|
|
1342
|
-
});
|
|
1343
|
-
configure(['@test/a']);
|
|
1344
|
-
|
|
1345
|
-
const result = await gapReport('General', {
|
|
1346
|
-
...reportOptions,
|
|
1347
|
-
cwd: projectDir,
|
|
1348
|
-
});
|
|
1349
|
-
expect(result.data.status).toBe('filed');
|
|
1350
|
-
});
|
|
1351
|
-
|
|
1352
|
-
it('mix of filed and failed → status partial', async () => {
|
|
1353
|
-
addIntegration({
|
|
1354
|
-
name: '@test/fail',
|
|
1355
|
-
audience: 'internal',
|
|
1356
|
-
handleBody: "throw new Error('boom');",
|
|
1357
|
-
});
|
|
1358
|
-
addIntegration({
|
|
1359
|
-
name: '@test/ok',
|
|
1360
|
-
audience: 'internal',
|
|
1361
|
-
handleBody: "return {status: 'filed', message: 'ok'};",
|
|
1362
|
-
});
|
|
1363
|
-
configure(['@test/fail', '@test/ok']);
|
|
1364
|
-
|
|
1365
|
-
const result = await gapReport('General', {
|
|
1366
|
-
...reportOptions,
|
|
1367
|
-
cwd: projectDir,
|
|
1368
|
-
});
|
|
1369
|
-
expect(result.data.status).toBe('partial');
|
|
1370
|
-
});
|
|
1371
|
-
|
|
1372
|
-
it('mix of failed and consent-required → status partial', async () => {
|
|
1373
|
-
addIntegration({
|
|
1374
|
-
name: '@test/fail',
|
|
1375
|
-
audience: 'internal',
|
|
1376
|
-
handleBody: "throw new Error('boom');",
|
|
1377
|
-
});
|
|
1378
|
-
addIntegration({
|
|
1379
|
-
name: '@test/public',
|
|
1380
|
-
audience: 'public',
|
|
1381
|
-
handleBody: "return {status: 'filed', message: 'public'};",
|
|
1382
|
-
});
|
|
1383
|
-
configure(['@test/fail', '@test/public']);
|
|
1384
|
-
|
|
1385
|
-
const result = await gapReport('General', {
|
|
1386
|
-
...reportOptions,
|
|
1387
|
-
cwd: projectDir,
|
|
1388
|
-
});
|
|
1389
|
-
|
|
1390
|
-
expect(result.data.status).toBe('partial');
|
|
1391
|
-
expect(result.data.deliveries.map(d => d.status)).toEqual([
|
|
1392
|
-
'failed',
|
|
1393
|
-
'consent_required',
|
|
1394
|
-
]);
|
|
1395
|
-
});
|
|
1396
|
-
|
|
1397
|
-
it('all failed → status failed', async () => {
|
|
1398
|
-
addIntegration({
|
|
1399
|
-
name: '@test/fail1',
|
|
1400
|
-
audience: 'internal',
|
|
1401
|
-
handleBody: "throw new Error('boom');",
|
|
1402
|
-
});
|
|
1403
|
-
configure(['@test/fail1']);
|
|
1404
|
-
|
|
1405
|
-
const result = await gapReport('General', {
|
|
1406
|
-
...reportOptions,
|
|
1407
|
-
cwd: projectDir,
|
|
1408
|
-
});
|
|
1409
|
-
expect(result.data.status).toBe('failed');
|
|
1410
|
-
});
|
|
1411
|
-
|
|
1412
|
-
it('report event shape is plain camelCase with no internal context', async () => {
|
|
1413
|
-
addIntegration({
|
|
1414
|
-
name: '@test/inspector',
|
|
1415
|
-
audience: 'internal',
|
|
1416
|
-
handleBody: `
|
|
1417
|
-
const keys = Object.keys(report).sort();
|
|
1418
|
-
const targetKeys = Object.keys(report.target).sort();
|
|
1419
|
-
return {
|
|
1420
|
-
status: 'filed',
|
|
1421
|
-
message: JSON.stringify({
|
|
1422
|
-
keys,
|
|
1423
|
-
targetKeys,
|
|
1424
|
-
source: report.source,
|
|
1425
|
-
sv: report.schemaVersion,
|
|
1426
|
-
}),
|
|
1427
|
-
};
|
|
1428
|
-
`,
|
|
1429
|
-
});
|
|
1430
|
-
configure(['@test/inspector']);
|
|
1431
|
-
vi.stubEnv('AGENT', 'secret-agent');
|
|
1432
|
-
|
|
1433
|
-
const result = await gapReport('Button', {
|
|
1434
|
-
...reportOptions,
|
|
1435
|
-
cwd: projectDir,
|
|
1436
|
-
});
|
|
1437
|
-
|
|
1438
|
-
const info = JSON.parse(result.data.deliveries[0].message);
|
|
1439
|
-
expect(info.sv).toBe(1);
|
|
1440
|
-
expect(info.source).toBe('ai');
|
|
1441
|
-
expect(info.keys).toEqual([
|
|
1442
|
-
'category',
|
|
1443
|
-
'categoryLabel',
|
|
1444
|
-
'component',
|
|
1445
|
-
'detail',
|
|
1446
|
-
'intention',
|
|
1447
|
-
'schemaVersion',
|
|
1448
|
-
'source',
|
|
1449
|
-
'target',
|
|
1450
|
-
'timestamp',
|
|
1451
|
-
]);
|
|
1452
|
-
expect(info.targetKeys).toEqual(['issuesUrl', 'package', 'version']);
|
|
1453
|
-
// No handler-private context fields or raw agent identifiers
|
|
1454
|
-
expect(result.data.deliveries[0].message).not.toContain('debug');
|
|
1455
|
-
expect(result.data.deliveries[0].message).not.toContain('context');
|
|
1456
|
-
expect(result.data.deliveries[0].message).not.toContain('secret-agent');
|
|
1457
|
-
});
|
|
1458
|
-
|
|
1459
|
-
it('receipt type is gap-report.file for the aggregate response', async () => {
|
|
1460
|
-
addIntegration({
|
|
1461
|
-
name: '@test/basic',
|
|
1462
|
-
audience: 'internal',
|
|
1463
|
-
handleBody: "return {status: 'filed', message: 'ok'};",
|
|
1464
|
-
});
|
|
1465
|
-
configure(['@test/basic']);
|
|
1466
|
-
|
|
1467
|
-
const result = await gapReport('General', {
|
|
1468
|
-
...reportOptions,
|
|
1469
|
-
cwd: projectDir,
|
|
1470
|
-
});
|
|
1471
|
-
|
|
1472
|
-
expect(result.type).toBe('gap-report.file');
|
|
1473
|
-
expect(result.data).toHaveProperty('deliveries');
|
|
1474
|
-
expect(result.data).toHaveProperty('filedCount');
|
|
1475
|
-
expect(result.data).toHaveProperty('routedOnlyCount');
|
|
1476
|
-
expect(result.data).toHaveProperty('status');
|
|
1477
|
-
expect(result.data).toHaveProperty('package');
|
|
1478
|
-
expect(result.data).toHaveProperty('issuesUrl');
|
|
1479
|
-
});
|
|
1480
|
-
});
|
|
1481
|
-
|
|
1482
|
-
describe('gapReport strict receipt validation', () => {
|
|
1483
|
-
it('rejects receipt with unknown fields', async () => {
|
|
1484
|
-
addIntegration({
|
|
1485
|
-
name: '@test/extra-fields',
|
|
1486
|
-
audience: 'internal',
|
|
1487
|
-
handleBody: "return {status: 'filed', message: 'ok', extra: true};",
|
|
1488
|
-
});
|
|
1489
|
-
configure(['@test/extra-fields']);
|
|
1490
|
-
|
|
1491
|
-
const result = await gapReport('General', {
|
|
1492
|
-
...reportOptions,
|
|
1493
|
-
cwd: projectDir,
|
|
1494
|
-
});
|
|
1495
|
-
|
|
1496
|
-
expect(result.data.deliveries[0].status).toBe('failed');
|
|
1497
|
-
});
|
|
1498
|
-
|
|
1499
|
-
it('rejects routed_only without url', async () => {
|
|
1500
|
-
addIntegration({
|
|
1501
|
-
name: '@test/no-url',
|
|
1502
|
-
audience: 'internal',
|
|
1503
|
-
handleBody: "return {status: 'routed_only', message: 'but no url'};",
|
|
1504
|
-
});
|
|
1505
|
-
configure(['@test/no-url']);
|
|
1506
|
-
|
|
1507
|
-
const result = await gapReport('General', {
|
|
1508
|
-
...reportOptions,
|
|
1509
|
-
cwd: projectDir,
|
|
1510
|
-
});
|
|
1511
|
-
|
|
1512
|
-
expect(result.data.deliveries[0].status).toBe('failed');
|
|
1513
|
-
});
|
|
1514
|
-
|
|
1515
|
-
it('accepts valid routed_only with url', async () => {
|
|
1516
|
-
addIntegration({
|
|
1517
|
-
name: '@test/routed',
|
|
1518
|
-
audience: 'internal',
|
|
1519
|
-
handleBody:
|
|
1520
|
-
"return {status: 'routed_only', url: 'https://example.com/issue/1'};",
|
|
1521
|
-
});
|
|
1522
|
-
configure(['@test/routed']);
|
|
1523
|
-
|
|
1524
|
-
const result = await gapReport('General', {
|
|
1525
|
-
...reportOptions,
|
|
1526
|
-
cwd: projectDir,
|
|
1527
|
-
});
|
|
1528
|
-
|
|
1529
|
-
expect(result.data.deliveries[0].status).toBe('routed_only');
|
|
1530
|
-
expect(result.data.routedOnlyCount).toBe(1);
|
|
1531
|
-
});
|
|
1532
|
-
|
|
1533
|
-
it('accepts skipped without url or message', async () => {
|
|
1534
|
-
addIntegration({
|
|
1535
|
-
name: '@test/skipper',
|
|
1536
|
-
audience: 'internal',
|
|
1537
|
-
handleBody: "return {status: 'skipped'};",
|
|
1538
|
-
});
|
|
1539
|
-
configure(['@test/skipper']);
|
|
1540
|
-
|
|
1541
|
-
const result = await gapReport('General', {
|
|
1542
|
-
...reportOptions,
|
|
1543
|
-
cwd: projectDir,
|
|
1544
|
-
});
|
|
1545
|
-
|
|
1546
|
-
expect(result.data.deliveries[0].status).toBe('skipped');
|
|
1547
|
-
expect(result.data.status).toBe('skipped');
|
|
1548
|
-
});
|
|
1549
|
-
});
|