@open-mercato/cli 0.11.1-develop.8593.1.50784dae35 → 0.11.1-develop.8687.1.adb16f62b3
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/.turbo/turbo-build.log +6 -2
- package/AGENTS.md +2 -0
- package/dist/agentic/guides/architecture.md +2 -2
- package/dist/agentic/guides/extensions.md +7 -2
- package/dist/agentic/guides/framework-extension-points.md +1 -0
- package/dist/agentic/guides/infrastructure-providers.md +20 -0
- package/dist/agentic/guides/integrations.md +2 -2
- package/dist/agentic/guides/module-facts.json +11067 -7122
- package/dist/agentic/guides/module-facts.v2.json +11055 -7094
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/assisted_selling/acl-features.md +16 -0
- package/dist/agentic/guides/modules/assisted_selling/contribution-resolutions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/domain-commands.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/entities.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/events.md +22 -0
- package/dist/agentic/guides/modules/assisted_selling/exact-override-targets.md +17 -0
- package/dist/agentic/guides/modules/assisted_selling/index.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/setup.md +11 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-contributions.md +21 -0
- package/dist/agentic/guides/modules/assisted_selling/umes-hosts.md +23 -0
- package/dist/agentic/guides/modules/attachments/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/workers.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/backups/di-registrations-rich.md +11 -0
- package/dist/agentic/guides/modules/backups/di-service-tokens.md +11 -0
- package/dist/agentic/guides/modules/backups/exact-override-targets.md +11 -0
- package/dist/agentic/guides/modules/backups/index.md +5 -2
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/acl-features.md +2 -1
- package/dist/agentic/guides/modules/catalog/active-extension-bindings.md +2 -0
- package/dist/agentic/guides/modules/catalog/backend-pages.md +1 -0
- package/dist/agentic/guides/modules/catalog/contribution-resolutions.md +5 -0
- package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +8 -7
- package/dist/agentic/guides/modules/catalog/di-service-tokens.md +5 -4
- package/dist/agentic/guides/modules/catalog/domain-commands.md +2 -0
- package/dist/agentic/guides/modules/catalog/entities.md +1 -0
- package/dist/agentic/guides/modules/catalog/events.md +4 -1
- package/dist/agentic/guides/modules/catalog/exact-override-targets.md +13 -7
- package/dist/agentic/guides/modules/catalog/index.md +9 -9
- package/dist/agentic/guides/modules/catalog/umes-contributions.md +5 -0
- package/dist/agentic/guides/modules/catalog/umes-hosts.md +4 -0
- package/dist/agentic/guides/modules/catalog/workers.md +1 -0
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/workers.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/currencies/di-registrations-rich.md +1 -1
- package/dist/agentic/guides/modules/currencies/di-service-tokens.md +1 -1
- package/dist/agentic/guides/modules/currencies/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +3 -2
- package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +2 -0
- package/dist/agentic/guides/modules/customer_accounts/index.md +2 -2
- package/dist/agentic/guides/modules/customer_accounts/workers.md +2 -0
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/active-extension-bindings.md +2 -1
- package/dist/agentic/guides/modules/customers/incoming-installed-contributions.md +1 -0
- package/dist/agentic/guides/modules/customers/index.md +3 -3
- package/dist/agentic/guides/modules/customers/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +0 -1
- package/dist/agentic/guides/modules/dashboards/cli-commands.md +1 -0
- package/dist/agentic/guides/modules/dashboards/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/dashboards/index.md +2 -3
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/di-registrations-rich.md +8 -8
- package/dist/agentic/guides/modules/integrations/di-service-tokens.md +4 -4
- package/dist/agentic/guides/modules/integrations/exact-override-targets.md +14 -12
- package/dist/agentic/guides/modules/integrations/index.md +2 -2
- package/dist/agentic/guides/modules/integrations/setup.md +1 -1
- package/dist/agentic/guides/modules/integrations/workers.md +3 -1
- package/dist/agentic/guides/modules/ledger/acl-features.md +16 -0
- package/dist/agentic/guides/modules/ledger/active-extension-bindings.md +11 -0
- package/dist/agentic/guides/modules/ledger/backend-pages.md +21 -0
- package/dist/agentic/guides/modules/ledger/domain-commands.md +22 -0
- package/dist/agentic/guides/modules/ledger/encryption.md +11 -0
- package/dist/agentic/guides/modules/ledger/entities.md +17 -0
- package/dist/agentic/guides/modules/ledger/events.md +19 -0
- package/dist/agentic/guides/modules/ledger/exact-override-targets.md +30 -0
- package/dist/agentic/guides/modules/ledger/index.md +22 -0
- package/dist/agentic/guides/modules/ledger/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/ledger/setup.md +11 -0
- package/dist/agentic/guides/modules/ledger/umes-hosts.md +26 -0
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/exact-override-targets.md +3 -3
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/resources/owned-contract-module-metadata.md +1 -1
- package/dist/agentic/guides/modules/resources/setup.md +1 -1
- package/dist/agentic/guides/modules/sales/contribution-resolutions.md +1 -0
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +1 -0
- package/dist/agentic/guides/modules/sales/index.md +3 -3
- package/dist/agentic/guides/modules/sales/umes-contributions.md +1 -0
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/contribution-resolutions.md +1 -1
- package/dist/agentic/guides/modules/staff/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/staff/workers.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +811 -21
- package/dist/agentic/guides/reference-modules/example/active-extension-bindings.md +1 -0
- package/dist/agentic/guides/reference-modules/example/backend-pages.md +2 -0
- package/dist/agentic/guides/reference-modules/example/contribution-resolutions.md +3 -1
- package/dist/agentic/guides/reference-modules/example/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/reference-modules/example/di-service-tokens.md +1 -1
- package/dist/agentic/guides/reference-modules/example/entities.md +2 -0
- package/dist/agentic/guides/reference-modules/example/events.md +2 -1
- package/dist/agentic/guides/reference-modules/example/exact-override-targets.md +25 -8
- package/dist/agentic/guides/reference-modules/example/index.md +7 -7
- package/dist/agentic/guides/reference-modules/example/notifications.md +1 -0
- package/dist/agentic/guides/reference-modules/example/setup.md +1 -1
- package/dist/agentic/guides/reference-modules/example/umes-contributions.md +3 -1
- package/dist/agentic/guides/reference-modules/example/umes-hosts.md +4 -0
- package/dist/agentic/guides/upstream/AGENTS.md +5 -4
- package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +37 -20
- package/dist/agentic/guides/upstream/manifest.json +3 -3
- package/dist/agentic/shared/AGENTS.md.template +12 -16
- package/dist/agentic/shared/ai/harness/README.md +4 -2
- package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
- package/dist/agentic/shared/ai/harness/cases.json +1420 -41
- package/dist/agentic/shared/ai/harness/cases.schema.json +4 -4
- package/dist/agentic/shared/ai/harness/design-system-inventory.json +640 -142
- package/dist/agentic/shared/ai/harness/source-link-inventory.json +223 -16
- package/dist/agentic/shared/ai/harness/validators.json +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +1 -1
- package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +25 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/mechanism-selector.md +1 -0
- package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +2 -0
- package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +21 -1
- package/dist/lib/cache-provider-manifest.js +9 -0
- package/dist/lib/cache-provider-manifest.js.map +7 -0
- package/dist/lib/generate-watch-plan.js +4 -0
- package/dist/lib/generate-watch-plan.js.map +2 -2
- package/dist/lib/generate-watch-runner.js +1 -0
- package/dist/lib/generate-watch-runner.js.map +2 -2
- package/dist/lib/generate-watch-structure.js +2 -0
- package/dist/lib/generate-watch-structure.js.map +2 -2
- package/dist/lib/generators/ast/writers.js +5 -1
- package/dist/lib/generators/ast/writers.js.map +2 -2
- package/dist/lib/generators/cache-providers.js +80 -0
- package/dist/lib/generators/cache-providers.js.map +7 -0
- package/dist/lib/generators/form-section-ast.js +156 -0
- package/dist/lib/generators/form-section-ast.js.map +7 -0
- package/dist/lib/generators/form-section-extension-compiler.js +568 -0
- package/dist/lib/generators/form-section-extension-compiler.js.map +7 -0
- package/dist/lib/generators/form-section-extension-source.js +245 -0
- package/dist/lib/generators/form-section-extension-source.js.map +7 -0
- package/dist/lib/generators/form-section-runtime-revisions.js +184 -0
- package/dist/lib/generators/form-section-runtime-revisions.js.map +7 -0
- package/dist/lib/generators/form-sections.js +773 -0
- package/dist/lib/generators/form-sections.js.map +7 -0
- package/dist/lib/generators/index.js +2 -0
- package/dist/lib/generators/index.js.map +2 -2
- package/dist/lib/generators/module-entities.js +21 -2
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-extension-facts.js +2 -1
- package/dist/lib/generators/module-extension-facts.js.map +2 -2
- package/dist/lib/generators/module-facts.js +30 -1
- package/dist/lib/generators/module-facts.js.map +2 -2
- package/dist/lib/generators/module-override-targets.js +24 -2
- package/dist/lib/generators/module-override-targets.js.map +2 -2
- package/dist/lib/generators/module-registry.js +75 -3
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/generators/openapi.js +27 -17
- package/dist/lib/generators/openapi.js.map +2 -2
- package/dist/lib/post-generate-invalidation.js +20 -1
- package/dist/lib/post-generate-invalidation.js.map +2 -2
- package/dist/lib/resolver.js +195 -1
- package/dist/lib/resolver.js.map +3 -3
- package/dist/lib/scaffold/field-dsl.js +393 -0
- package/dist/lib/scaffold/field-dsl.js.map +7 -0
- package/dist/lib/scaffold/index.js +412 -0
- package/dist/lib/scaffold/index.js.map +7 -0
- package/dist/lib/scaffold/targets.js +42 -0
- package/dist/lib/scaffold/targets.js.map +7 -0
- package/dist/lib/scaffold/templates/create-page.js +52 -0
- package/dist/lib/scaffold/templates/create-page.js.map +7 -0
- package/dist/lib/scaffold/templates/detail-page.js +186 -0
- package/dist/lib/scaffold/templates/detail-page.js.map +7 -0
- package/dist/lib/scaffold/templates/form-config.js +42 -0
- package/dist/lib/scaffold/templates/form-config.js.map +7 -0
- package/dist/lib/scaffold/templates/index.js +27 -0
- package/dist/lib/scaffold/templates/index.js.map +7 -0
- package/dist/lib/scaffold/templates/list-page.js +190 -0
- package/dist/lib/scaffold/templates/list-page.js.map +7 -0
- package/dist/lib/scaffold/templates/metas.js +47 -0
- package/dist/lib/scaffold/templates/metas.js.map +7 -0
- package/dist/lib/scaffold/templates/module-files.js +85 -0
- package/dist/lib/scaffold/templates/module-files.js.map +7 -0
- package/dist/lib/single-instance-strategy-guard.js +26 -3
- package/dist/lib/single-instance-strategy-guard.js.map +2 -2
- package/dist/lib/testing/integration-discovery.js +32 -3
- package/dist/lib/testing/integration-discovery.js.map +2 -2
- package/dist/lib/testing/integration.js +232 -8
- package/dist/lib/testing/integration.js.map +2 -2
- package/dist/mercato.js +40 -7
- package/dist/mercato.js.map +2 -2
- package/jest.config.cjs +2 -0
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +18 -0
- package/src/__tests__/rotation-json-output.test.ts +52 -0
- package/src/lib/__tests__/agentic-workflows-ownership.test.ts +79 -0
- package/src/lib/__tests__/cache-provider-manifest.test.ts +76 -0
- package/src/lib/__tests__/generate-watch-plan.test.ts +3 -2
- package/src/lib/__tests__/generate-watch-runner.test.ts +13 -1
- package/src/lib/__tests__/generate-watch-structure.test.ts +34 -0
- package/src/lib/__tests__/post-generate-invalidation.test.ts +108 -0
- package/src/lib/__tests__/resolver.form-section-gates.test.ts +82 -0
- package/src/lib/__tests__/single-instance-strategy-guard.test.ts +129 -0
- package/src/lib/cache-provider-manifest.ts +8 -0
- package/src/lib/generate-watch-plan.ts +6 -3
- package/src/lib/generate-watch-runner.ts +1 -0
- package/src/lib/generate-watch-structure.ts +5 -1
- package/src/lib/generators/__tests__/cache-providers.test.ts +102 -0
- package/src/lib/generators/__tests__/derived-crud-route-collisions.test.ts +85 -0
- package/src/lib/generators/__tests__/form-section-outbox.test.ts +53 -0
- package/src/lib/generators/__tests__/form-sections.test.ts +896 -0
- package/src/lib/generators/__tests__/module-extension-facts.test.ts +1 -0
- package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +8 -6
- package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +37 -13
- package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +13 -0
- package/src/lib/generators/__tests__/module-override-targets.test.ts +2 -3
- package/src/lib/generators/__tests__/module-subset.test.ts +1 -1
- package/src/lib/generators/__tests__/openapi.test.ts +60 -13
- package/src/lib/generators/__tests__/structural-contracts.test.ts +2 -2
- package/src/lib/generators/ast/writers.ts +6 -1
- package/src/lib/generators/cache-providers.ts +111 -0
- package/src/lib/generators/form-section-ast.ts +166 -0
- package/src/lib/generators/form-section-extension-compiler.ts +632 -0
- package/src/lib/generators/form-section-extension-source.ts +308 -0
- package/src/lib/generators/form-section-runtime-revisions.ts +211 -0
- package/src/lib/generators/form-sections.ts +896 -0
- package/src/lib/generators/index.ts +1 -0
- package/src/lib/generators/module-entities.ts +22 -4
- package/src/lib/generators/module-extension-facts.ts +1 -0
- package/src/lib/generators/module-facts.ts +40 -0
- package/src/lib/generators/module-override-targets.ts +19 -0
- package/src/lib/generators/module-registry.ts +80 -4
- package/src/lib/generators/openapi.ts +31 -20
- package/src/lib/post-generate-invalidation.ts +28 -1
- package/src/lib/resolver.ts +218 -0
- package/src/lib/scaffold/__tests__/__snapshots__/scaffold-golden.test.ts.snap +1742 -0
- package/src/lib/scaffold/__tests__/helpers.ts +75 -0
- package/src/lib/scaffold/__tests__/scaffold-ds-contract.test.ts +248 -0
- package/src/lib/scaffold/__tests__/scaffold-golden.test.ts +267 -0
- package/src/lib/scaffold/__tests__/scaffold-runtime.test.tsx +193 -0
- package/src/lib/scaffold/field-dsl.ts +491 -0
- package/src/lib/scaffold/index.ts +531 -0
- package/src/lib/scaffold/targets.ts +68 -0
- package/src/lib/scaffold/templates/create-page.ts +52 -0
- package/src/lib/scaffold/templates/detail-page.ts +190 -0
- package/src/lib/scaffold/templates/form-config.ts +42 -0
- package/src/lib/scaffold/templates/index.ts +27 -0
- package/src/lib/scaffold/templates/list-page.ts +190 -0
- package/src/lib/scaffold/templates/metas.ts +48 -0
- package/src/lib/scaffold/templates/module-files.ts +87 -0
- package/src/lib/single-instance-strategy-guard.ts +51 -1
- package/src/lib/testing/__tests__/integration-app-only-playwright.test.ts +225 -0
- package/src/lib/testing/__tests__/integration-app-only.test.ts +320 -0
- package/src/lib/testing/__tests__/integration-discovery.test.ts +45 -1
- package/src/lib/testing/integration-discovery.ts +32 -2
- package/src/lib/testing/integration.ts +293 -11
- package/src/mercato.ts +39 -5
- package/dist/agentic/guides/modules/dashboards/incoming-installed-contributions.md +0 -11
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import os from 'node:os'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import {
|
|
5
|
+
buildAppOnlyPlaywrightFileFilters,
|
|
6
|
+
listAppOwnedIntegrationSpecCandidates,
|
|
7
|
+
listPlaywrightConfigSelectedSpecPaths,
|
|
8
|
+
listPlaywrightSelectedSpecPaths,
|
|
9
|
+
resolveAppOnlySuiteRun,
|
|
10
|
+
} from '../integration'
|
|
11
|
+
import type { PlaywrightListTarget } from '../integration'
|
|
12
|
+
|
|
13
|
+
const RUNTIME_REGISTERED_SPEC = 'src/modules/orders/__integration__/TC-APP-001.spec.ts'
|
|
14
|
+
const RUNTIME_IMPORTED_SPEC = 'src/modules/orders/__integration__/TC-APP-002.spec.ts'
|
|
15
|
+
const CONFIG_PATH = '.ai/qa/tests/playwright.config.ts'
|
|
16
|
+
const CUSTOM_CONFIG_PATH = '.ai/qa/tests/custom.config.ts'
|
|
17
|
+
const CUSTOM_ROOT_CONFIG_PATH = '.ai/qa/tests/custom-smoke.config.ts'
|
|
18
|
+
const CUSTOM_EMPTY_CONFIG_PATH = '.ai/qa/tests/custom-empty.config.ts'
|
|
19
|
+
const SMOKE_SPEC = 'smoke/__integration__/TC-SMOKE-001.spec.ts'
|
|
20
|
+
const SERVICE_SPEC = 'smoke/__integration__/TC-SERVICE-001.spec.ts'
|
|
21
|
+
const REPOSITORY_NODE_MODULES = path.resolve(path.dirname(require.resolve('@playwright/test/package.json')), '..', '..')
|
|
22
|
+
const DISCOVERY_MODULE_PATH = path.resolve(__dirname, '..', 'integration-discovery.ts')
|
|
23
|
+
const RUNTIME_BASE_URL = 'http://127.0.0.1:5001'
|
|
24
|
+
|
|
25
|
+
function withoutJestEnvironment(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|
26
|
+
return Object.fromEntries(Object.entries(environment).filter(([key]) => !key.startsWith('JEST_')))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function writeProjectFile(projectRoot: string, relativePath: string, contents: string): void {
|
|
30
|
+
const absolutePath = path.join(projectRoot, relativePath)
|
|
31
|
+
mkdirSync(path.dirname(absolutePath), { recursive: true })
|
|
32
|
+
writeFileSync(absolutePath, contents)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function createStandaloneProject(): string {
|
|
36
|
+
const projectRoot = realpathSync(mkdtempSync(path.join(os.tmpdir(), 'om-app-only-')))
|
|
37
|
+
symlinkSync(REPOSITORY_NODE_MODULES, path.join(projectRoot, 'node_modules'), 'dir')
|
|
38
|
+
writeProjectFile(projectRoot, 'package.json', JSON.stringify({ name: 'app-only-fixture', private: true }))
|
|
39
|
+
writeProjectFile(
|
|
40
|
+
projectRoot,
|
|
41
|
+
CONFIG_PATH,
|
|
42
|
+
[
|
|
43
|
+
"import { defineConfig } from '@playwright/test'",
|
|
44
|
+
"import path from 'node:path'",
|
|
45
|
+
`import { discoverIntegrationSpecFiles } from ${JSON.stringify(DISCOVERY_MODULE_PATH)}`,
|
|
46
|
+
"const projectRoot = path.resolve(__dirname, '..', '..', '..')",
|
|
47
|
+
"const legacyRoot = path.join(projectRoot, '.ai', 'qa', 'tests', '__legacy_disabled__')",
|
|
48
|
+
'const specPaths = discoverIntegrationSpecFiles(projectRoot, legacyRoot).map((entry) => entry.path)',
|
|
49
|
+
'export default defineConfig({',
|
|
50
|
+
' testDir: projectRoot,',
|
|
51
|
+
" testMatch: specPaths.length > 0 ? specPaths : ['.ai/qa/tests/__no_tests__/*.spec.ts'],",
|
|
52
|
+
" testIgnore: [`${projectRoot}/node_modules/**`],",
|
|
53
|
+
'})',
|
|
54
|
+
'',
|
|
55
|
+
].join('\n'),
|
|
56
|
+
)
|
|
57
|
+
writeProjectFile(
|
|
58
|
+
projectRoot,
|
|
59
|
+
CUSTOM_CONFIG_PATH,
|
|
60
|
+
[
|
|
61
|
+
"import { defineConfig } from '@playwright/test'",
|
|
62
|
+
"import path from 'node:path'",
|
|
63
|
+
"const projectRoot = path.resolve(__dirname, '..', '..', '..')",
|
|
64
|
+
"export default defineConfig({ testDir: path.join(projectRoot, 'src'), testMatch: ['**/__integration__/*.spec.ts'] })",
|
|
65
|
+
'',
|
|
66
|
+
].join('\n'),
|
|
67
|
+
)
|
|
68
|
+
writeProjectFile(
|
|
69
|
+
projectRoot,
|
|
70
|
+
CUSTOM_ROOT_CONFIG_PATH,
|
|
71
|
+
[
|
|
72
|
+
"import { defineConfig } from '@playwright/test'",
|
|
73
|
+
"import path from 'node:path'",
|
|
74
|
+
"const projectRoot = path.resolve(__dirname, '..', '..', '..')",
|
|
75
|
+
"export default defineConfig({ testDir: path.join(projectRoot, 'smoke'), testMatch: ['**/__integration__/*.spec.ts'] })",
|
|
76
|
+
'',
|
|
77
|
+
].join('\n'),
|
|
78
|
+
)
|
|
79
|
+
writeProjectFile(
|
|
80
|
+
projectRoot,
|
|
81
|
+
CUSTOM_EMPTY_CONFIG_PATH,
|
|
82
|
+
[
|
|
83
|
+
"import { defineConfig } from '@playwright/test'",
|
|
84
|
+
"import path from 'node:path'",
|
|
85
|
+
"const projectRoot = path.resolve(__dirname, '..', '..', '..')",
|
|
86
|
+
"export default defineConfig({ testDir: path.join(projectRoot, 'empty'), testMatch: ['**/__integration__/*.spec.ts'] })",
|
|
87
|
+
'',
|
|
88
|
+
].join('\n'),
|
|
89
|
+
)
|
|
90
|
+
writeProjectFile(projectRoot, 'empty/README.md', 'No app specs yet.\n')
|
|
91
|
+
writeProjectFile(
|
|
92
|
+
projectRoot,
|
|
93
|
+
SMOKE_SPEC,
|
|
94
|
+
["import { test } from '@playwright/test'", "test('smoke passes', async () => {})", ''].join('\n'),
|
|
95
|
+
)
|
|
96
|
+
writeProjectFile(
|
|
97
|
+
projectRoot,
|
|
98
|
+
SERVICE_SPEC,
|
|
99
|
+
[
|
|
100
|
+
"import { test } from '@playwright/test'",
|
|
101
|
+
"throw new Error('a separate service is required while this spec module loads')",
|
|
102
|
+
"test('needs the separate service', async () => {})",
|
|
103
|
+
'',
|
|
104
|
+
].join('\n'),
|
|
105
|
+
)
|
|
106
|
+
writeProjectFile(
|
|
107
|
+
projectRoot,
|
|
108
|
+
RUNTIME_REGISTERED_SPEC,
|
|
109
|
+
[
|
|
110
|
+
"import { test } from '@playwright/test'",
|
|
111
|
+
'if (process.env.BASE_URL) {',
|
|
112
|
+
" test('registers only once the runtime supplies BASE_URL', async () => {})",
|
|
113
|
+
'}',
|
|
114
|
+
'',
|
|
115
|
+
].join('\n'),
|
|
116
|
+
)
|
|
117
|
+
writeProjectFile(
|
|
118
|
+
projectRoot,
|
|
119
|
+
RUNTIME_IMPORTED_SPEC,
|
|
120
|
+
[
|
|
121
|
+
"import { test } from '@playwright/test'",
|
|
122
|
+
"if (!process.env.BASE_URL) throw new Error('BASE_URL is required while this spec module loads')",
|
|
123
|
+
"test('imports only once the runtime supplies BASE_URL', async () => {})",
|
|
124
|
+
'',
|
|
125
|
+
].join('\n'),
|
|
126
|
+
)
|
|
127
|
+
return projectRoot
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
describe('test:integration --app-only against a real Playwright config', () => {
|
|
131
|
+
const originalBaseUrl = process.env.BASE_URL
|
|
132
|
+
let projectRoot: string
|
|
133
|
+
let target: PlaywrightListTarget
|
|
134
|
+
const listRegisteredTests = (environment: NodeJS.ProcessEnv, fileFilters: readonly string[]) =>
|
|
135
|
+
listPlaywrightSelectedSpecPaths(withoutJestEnvironment(environment), fileFilters, target)
|
|
136
|
+
const listConfigSelection = (environment: NodeJS.ProcessEnv) =>
|
|
137
|
+
listPlaywrightConfigSelectedSpecPaths(withoutJestEnvironment(environment), target)
|
|
138
|
+
|
|
139
|
+
beforeAll(() => {
|
|
140
|
+
delete process.env.BASE_URL
|
|
141
|
+
projectRoot = createStandaloneProject()
|
|
142
|
+
target = { projectRoot, configPath: CONFIG_PATH }
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
afterAll(() => {
|
|
146
|
+
if (originalBaseUrl === undefined) {
|
|
147
|
+
delete process.env.BASE_URL
|
|
148
|
+
} else {
|
|
149
|
+
process.env.BASE_URL = originalBaseUrl
|
|
150
|
+
}
|
|
151
|
+
rmSync(projectRoot, { recursive: true, force: true })
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('cannot import the specs before the runtime supplies BASE_URL', async () => {
|
|
155
|
+
await expect(listRegisteredTests({ ...process.env }, [])).rejects.toThrow('BASE_URL is required')
|
|
156
|
+
}, 60_000)
|
|
157
|
+
|
|
158
|
+
it('resolves both runtime-dependent specs from the config file selection without importing them', async () => {
|
|
159
|
+
const candidates = await listAppOwnedIntegrationSpecCandidates(listConfigSelection)
|
|
160
|
+
expect(candidates).toEqual([{ path: RUNTIME_REGISTERED_SPEC }, { path: RUNTIME_IMPORTED_SPEC }])
|
|
161
|
+
}, 60_000)
|
|
162
|
+
|
|
163
|
+
it('collects both specs once the runtime environment supplies BASE_URL', async () => {
|
|
164
|
+
const run = await resolveAppOnlySuiteRun(
|
|
165
|
+
[RUNTIME_REGISTERED_SPEC, RUNTIME_IMPORTED_SPEC],
|
|
166
|
+
{ commandEnvironment: { ...process.env, BASE_URL: RUNTIME_BASE_URL } },
|
|
167
|
+
listRegisteredTests,
|
|
168
|
+
)
|
|
169
|
+
expect(run?.fileFilters).toHaveLength(2)
|
|
170
|
+
expect(run?.commandEnvironment.BASE_URL).toBe(RUNTIME_BASE_URL)
|
|
171
|
+
}, 60_000)
|
|
172
|
+
|
|
173
|
+
it('reports no selection for a custom config that does not use discovery, deferring to the runtime list', async () => {
|
|
174
|
+
const customTarget = { projectRoot, configPath: CUSTOM_CONFIG_PATH }
|
|
175
|
+
await expect(
|
|
176
|
+
listPlaywrightConfigSelectedSpecPaths(withoutJestEnvironment({ ...process.env }), customTarget),
|
|
177
|
+
).resolves.toBeNull()
|
|
178
|
+
const run = await resolveAppOnlySuiteRun(
|
|
179
|
+
null,
|
|
180
|
+
{ commandEnvironment: { ...process.env, BASE_URL: RUNTIME_BASE_URL } },
|
|
181
|
+
(environment, fileFilters) =>
|
|
182
|
+
listPlaywrightSelectedSpecPaths(withoutJestEnvironment(environment), fileFilters, customTarget),
|
|
183
|
+
)
|
|
184
|
+
expect(run?.fileFilters).toHaveLength(2)
|
|
185
|
+
}, 60_000)
|
|
186
|
+
|
|
187
|
+
it('applies --filter before importing specs for a custom config without a discovery report', async () => {
|
|
188
|
+
const customTarget = { projectRoot, configPath: CUSTOM_ROOT_CONFIG_PATH }
|
|
189
|
+
const listCustom = (environment: NodeJS.ProcessEnv, fileFilters: readonly string[]) =>
|
|
190
|
+
listPlaywrightSelectedSpecPaths(withoutJestEnvironment(environment), fileFilters, customTarget)
|
|
191
|
+
await expect(listCustom({ ...process.env }, [])).rejects.toThrow('a separate service is required')
|
|
192
|
+
const run = await resolveAppOnlySuiteRun(
|
|
193
|
+
null,
|
|
194
|
+
{ commandEnvironment: { ...process.env, BASE_URL: RUNTIME_BASE_URL } },
|
|
195
|
+
listCustom,
|
|
196
|
+
'TC-SMOKE',
|
|
197
|
+
)
|
|
198
|
+
expect(run?.fileFilters).toEqual(buildAppOnlyPlaywrightFileFilters([SMOKE_SPEC]))
|
|
199
|
+
}, 60_000)
|
|
200
|
+
|
|
201
|
+
it('fails a mistyped --filter for a custom config without a discovery report, still without importing other specs', async () => {
|
|
202
|
+
const customTarget = { projectRoot, configPath: CUSTOM_ROOT_CONFIG_PATH }
|
|
203
|
+
await expect(
|
|
204
|
+
resolveAppOnlySuiteRun(
|
|
205
|
+
null,
|
|
206
|
+
{ commandEnvironment: { ...process.env, BASE_URL: RUNTIME_BASE_URL } },
|
|
207
|
+
(environment, fileFilters) =>
|
|
208
|
+
listPlaywrightSelectedSpecPaths(withoutJestEnvironment(environment), fileFilters, customTarget),
|
|
209
|
+
'TC-SMOKY',
|
|
210
|
+
),
|
|
211
|
+
).rejects.toThrow('No app-owned integration specs match filter "TC-SMOKY"')
|
|
212
|
+
}, 60_000)
|
|
213
|
+
|
|
214
|
+
it('treats an empty app suite under a custom config without a discovery report as nothing to run', async () => {
|
|
215
|
+
const customTarget = { projectRoot, configPath: CUSTOM_EMPTY_CONFIG_PATH }
|
|
216
|
+
await expect(
|
|
217
|
+
resolveAppOnlySuiteRun(
|
|
218
|
+
null,
|
|
219
|
+
{ commandEnvironment: { ...process.env, BASE_URL: RUNTIME_BASE_URL } },
|
|
220
|
+
(environment, fileFilters) =>
|
|
221
|
+
listPlaywrightSelectedSpecPaths(withoutJestEnvironment(environment), fileFilters, customTarget),
|
|
222
|
+
),
|
|
223
|
+
).resolves.toBeNull()
|
|
224
|
+
}, 60_000)
|
|
225
|
+
})
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INTEGRATION_TEST_USAGE,
|
|
3
|
+
NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE,
|
|
4
|
+
buildAppOnlyPlaywrightFileFilters,
|
|
5
|
+
listAppOwnedIntegrationSpecCandidates,
|
|
6
|
+
parseOptions,
|
|
7
|
+
parsePlaywrightListedSpecPaths,
|
|
8
|
+
resolveAppOnlySuiteRun,
|
|
9
|
+
resolveAppOwnedIntegrationSpecPaths,
|
|
10
|
+
runIntegrationTestsInEphemeralEnvironment,
|
|
11
|
+
} from '../integration'
|
|
12
|
+
import type { EphemeralEnvironmentHandle, IntegrationTestRunDependencies } from '../integration'
|
|
13
|
+
|
|
14
|
+
type RunSuiteWithRecovery = NonNullable<IntegrationTestRunDependencies['runSuiteWithRecovery']>
|
|
15
|
+
|
|
16
|
+
const APP_SPEC = 'src/modules/orders/__integration__/TC-APP-001.spec.ts'
|
|
17
|
+
const SECOND_APP_SPEC = 'src/modules/orders/__integration__/admin/TC-APP-002.spec.ts'
|
|
18
|
+
const PLATFORM_SPEC = 'node_modules/@open-mercato/webhooks/src/modules/webhooks/__integration__/TC-WH-001.spec.ts'
|
|
19
|
+
|
|
20
|
+
function createRunSuiteMock() {
|
|
21
|
+
const stop = jest.fn(async () => {})
|
|
22
|
+
const environment = {
|
|
23
|
+
baseUrl: 'http://127.0.0.1:5001',
|
|
24
|
+
port: 5001,
|
|
25
|
+
databaseUrl: 'postgres://localhost/test',
|
|
26
|
+
commandEnvironment: { PW_CAPTURE_SCREENSHOTS: '0' },
|
|
27
|
+
ownedByCurrentProcess: true,
|
|
28
|
+
stop,
|
|
29
|
+
} satisfies EphemeralEnvironmentHandle
|
|
30
|
+
const runSuite = jest.fn<ReturnType<RunSuiteWithRecovery>, Parameters<RunSuiteWithRecovery>>(async () => ({
|
|
31
|
+
environment,
|
|
32
|
+
testRunResult: { retried: false, error: null },
|
|
33
|
+
}))
|
|
34
|
+
return { runSuite, stop }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('mercato test:integration --app-only', () => {
|
|
38
|
+
let logSpy: jest.SpyInstance
|
|
39
|
+
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
logSpy = jest.spyOn(console, 'log').mockImplementation(() => {})
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
logSpy.mockRestore()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
describe('parseOptions', () => {
|
|
49
|
+
it('leaves app-only and help disabled by default', () => {
|
|
50
|
+
expect(parseOptions([])).toMatchObject({ appOnly: false, help: false, filter: null })
|
|
51
|
+
expect(parseOptions(['customers'])).toMatchObject({ appOnly: false, filter: 'customers' })
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('parses --app-only alongside a filter in any position', () => {
|
|
55
|
+
expect(parseOptions(['--app-only'])).toMatchObject({ appOnly: true, filter: null })
|
|
56
|
+
expect(parseOptions(['--app-only', 'orders'])).toMatchObject({ appOnly: true, filter: 'orders' })
|
|
57
|
+
expect(parseOptions(['--filter', 'orders', '--app-only', '--no-reuse-env'])).toMatchObject({
|
|
58
|
+
appOnly: true,
|
|
59
|
+
filter: 'orders',
|
|
60
|
+
reuseExisting: false,
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('parses --help and -h', () => {
|
|
65
|
+
expect(parseOptions(['--help'])).toMatchObject({ help: true })
|
|
66
|
+
expect(parseOptions(['-h'])).toMatchObject({ help: true, filter: null })
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it('still rejects unknown options', () => {
|
|
70
|
+
expect(() => parseOptions(['--app-only=true'])).toThrow('Unknown option: --app-only=true')
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
describe('resolveAppOwnedIntegrationSpecPaths', () => {
|
|
75
|
+
it('drops specs installed under node_modules', () => {
|
|
76
|
+
expect(
|
|
77
|
+
resolveAppOwnedIntegrationSpecPaths([{ path: APP_SPEC }, { path: PLATFORM_SPEC }, { path: SECOND_APP_SPEC }], null),
|
|
78
|
+
).toEqual([APP_SPEC, SECOND_APP_SPEC])
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('returns an empty list when only platform specs are discovered', () => {
|
|
82
|
+
expect(resolveAppOwnedIntegrationSpecPaths([{ path: PLATFORM_SPEC }], null)).toEqual([])
|
|
83
|
+
expect(resolveAppOwnedIntegrationSpecPaths([], 'orders')).toEqual([])
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('narrows app-owned specs by a case-insensitive filter', () => {
|
|
87
|
+
expect(resolveAppOwnedIntegrationSpecPaths([{ path: APP_SPEC }, { path: SECOND_APP_SPEC }], 'admin/')).toEqual([
|
|
88
|
+
SECOND_APP_SPEC,
|
|
89
|
+
])
|
|
90
|
+
expect(resolveAppOwnedIntegrationSpecPaths([{ path: APP_SPEC }, { path: PLATFORM_SPEC }], 'tc-app')).toEqual([APP_SPEC])
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it('fails loudly when a filter matches none of the existing app-owned specs', () => {
|
|
94
|
+
expect(() => resolveAppOwnedIntegrationSpecPaths([{ path: APP_SPEC }, { path: PLATFORM_SPEC }], 'webhooks')).toThrow(
|
|
95
|
+
'No app-owned integration specs match filter "webhooks"',
|
|
96
|
+
)
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
describe('parsePlaywrightListedSpecPaths', () => {
|
|
101
|
+
it('returns the listed spec files relative to the project root', () => {
|
|
102
|
+
const report = {
|
|
103
|
+
config: { rootDir: '/repo' },
|
|
104
|
+
suites: [
|
|
105
|
+
{ file: SECOND_APP_SPEC, specs: [] },
|
|
106
|
+
{ file: APP_SPEC, specs: [] },
|
|
107
|
+
{ file: APP_SPEC, specs: [] },
|
|
108
|
+
{ title: 'no file' },
|
|
109
|
+
],
|
|
110
|
+
}
|
|
111
|
+
expect(parsePlaywrightListedSpecPaths(report, '/repo')).toEqual([SECOND_APP_SPEC, APP_SPEC])
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it('reads the file list from a report shaped like real Playwright 1.62 --list output', () => {
|
|
115
|
+
const report = {
|
|
116
|
+
config: { configFile: '/repo/.ai/qa/tests/playwright.config.ts', rootDir: '/repo' },
|
|
117
|
+
suites: [
|
|
118
|
+
{
|
|
119
|
+
title: APP_SPEC,
|
|
120
|
+
file: APP_SPEC,
|
|
121
|
+
column: 0,
|
|
122
|
+
line: 0,
|
|
123
|
+
specs: [],
|
|
124
|
+
suites: [
|
|
125
|
+
{
|
|
126
|
+
title: 'TC-APP-001: orders',
|
|
127
|
+
file: APP_SPEC,
|
|
128
|
+
line: 4,
|
|
129
|
+
column: 6,
|
|
130
|
+
specs: [
|
|
131
|
+
{
|
|
132
|
+
title: 'creates an order',
|
|
133
|
+
ok: true,
|
|
134
|
+
tags: [],
|
|
135
|
+
tests: [{ timeout: 20000, annotations: [], expectedStatus: 'passed', projectId: '', projectName: '', results: [], status: 'skipped' }],
|
|
136
|
+
id: 'a623f8b76ba3e0f24645-22392273f45316c64329',
|
|
137
|
+
file: APP_SPEC,
|
|
138
|
+
line: 5,
|
|
139
|
+
column: 3,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
errors: [],
|
|
147
|
+
stats: { expected: 0, skipped: 0, unexpected: 0, flaky: 0 },
|
|
148
|
+
}
|
|
149
|
+
expect(parsePlaywrightListedSpecPaths(report, '/repo')).toEqual([APP_SPEC])
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
it('resolves files against the report rootDir when it differs from the project root', () => {
|
|
153
|
+
const report = { config: { rootDir: '/repo/src' }, suites: [{ file: 'modules/orders/__integration__/TC-APP-001.spec.ts' }] }
|
|
154
|
+
expect(parsePlaywrightListedSpecPaths(report, '/repo')).toEqual([APP_SPEC])
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it('rejects output that is not a Playwright report', () => {
|
|
158
|
+
expect(() => parsePlaywrightListedSpecPaths({ errors: [] }, '/repo')).toThrow('Playwright --list report has no suites')
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
describe('listAppOwnedIntegrationSpecCandidates', () => {
|
|
163
|
+
it('asks the Playwright config for app-only specs with metadata filters skipped', async () => {
|
|
164
|
+
const listSpecs = jest.fn(async () => [APP_SPEC])
|
|
165
|
+
|
|
166
|
+
await expect(listAppOwnedIntegrationSpecCandidates(listSpecs)).resolves.toEqual([{ path: APP_SPEC }])
|
|
167
|
+
|
|
168
|
+
expect(listSpecs).toHaveBeenCalledTimes(1)
|
|
169
|
+
expect(listSpecs.mock.calls[0][0]).toMatchObject({
|
|
170
|
+
OM_INTEGRATION_APP_ONLY: '1',
|
|
171
|
+
OM_INTEGRATION_SKIP_METADATA_FILTERS: '1',
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
describe('listAppOwnedIntegrationSpecCandidates without a config report', () => {
|
|
177
|
+
it('returns null so the empty-suite decision waits for the runtime', async () => {
|
|
178
|
+
await expect(listAppOwnedIntegrationSpecCandidates(async () => null)).resolves.toBeNull()
|
|
179
|
+
})
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
describe('resolveAppOnlySuiteRun', () => {
|
|
183
|
+
const listSpecsNeedingBaseUrl = jest.fn(async (environment: NodeJS.ProcessEnv) =>
|
|
184
|
+
environment.BASE_URL ? [APP_SPEC] : [],
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
beforeEach(() => {
|
|
188
|
+
listSpecsNeedingBaseUrl.mockClear()
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it('runs a lone spec that requires a variable the runtime environment provides', async () => {
|
|
192
|
+
const run = await resolveAppOnlySuiteRun(
|
|
193
|
+
[APP_SPEC],
|
|
194
|
+
{ commandEnvironment: { BASE_URL: 'http://127.0.0.1:5001' } },
|
|
195
|
+
listSpecsNeedingBaseUrl,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
expect(run).toEqual({
|
|
199
|
+
fileFilters: buildAppOnlyPlaywrightFileFilters([APP_SPEC]),
|
|
200
|
+
commandEnvironment: { BASE_URL: 'http://127.0.0.1:5001', OM_INTEGRATION_APP_ONLY: '1' },
|
|
201
|
+
})
|
|
202
|
+
expect(listSpecsNeedingBaseUrl.mock.calls[0][0]).not.toHaveProperty('OM_INTEGRATION_SKIP_METADATA_FILTERS')
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
it('returns null when the runtime environment still skips every app spec', async () => {
|
|
206
|
+
await expect(resolveAppOnlySuiteRun([APP_SPEC], { commandEnvironment: {} }, listSpecsNeedingBaseUrl)).resolves.toBeNull()
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
it('lists only the preflight spec files so excluded specs are never imported', async () => {
|
|
210
|
+
const listSpecs = jest.fn(async () => [APP_SPEC])
|
|
211
|
+
await resolveAppOnlySuiteRun([APP_SPEC], { commandEnvironment: {} }, listSpecs)
|
|
212
|
+
expect(listSpecs.mock.calls[0][1]).toEqual(buildAppOnlyPlaywrightFileFilters([APP_SPEC]))
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
it('resolves app-owned specs from the runtime list when the config reported no selection', async () => {
|
|
216
|
+
const listSpecs = jest.fn(async () => [PLATFORM_SPEC, APP_SPEC, SECOND_APP_SPEC])
|
|
217
|
+
const run = await resolveAppOnlySuiteRun(null, { commandEnvironment: {} }, listSpecs)
|
|
218
|
+
expect(listSpecs.mock.calls[0][1]).toEqual([])
|
|
219
|
+
expect(run?.fileFilters).toEqual(buildAppOnlyPlaywrightFileFilters([APP_SPEC, SECOND_APP_SPEC]))
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
it('narrows the runtime collection with --filter when the config reported no selection', async () => {
|
|
223
|
+
const listSpecs = jest.fn(async () => [PLATFORM_SPEC, SECOND_APP_SPEC])
|
|
224
|
+
const run = await resolveAppOnlySuiteRun(null, { commandEnvironment: {} }, listSpecs, 'admin')
|
|
225
|
+
expect(listSpecs.mock.calls[0][1]).toEqual(['admin'])
|
|
226
|
+
expect(run?.fileFilters).toEqual(buildAppOnlyPlaywrightFileFilters([SECOND_APP_SPEC]))
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
it('fails when --filter collects no spec and the config reported no selection', async () => {
|
|
230
|
+
const listSpecs = jest.fn(async () => [])
|
|
231
|
+
await expect(resolveAppOnlySuiteRun(null, { commandEnvironment: {} }, listSpecs, 'TC-SMOKY')).rejects.toThrow(
|
|
232
|
+
'No app-owned integration specs match filter "TC-SMOKY"',
|
|
233
|
+
)
|
|
234
|
+
expect(listSpecs.mock.calls[0][1]).toEqual(['TC-SMOKY'])
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
it('returns null when the runtime list has no app-owned spec and the config reported no selection', async () => {
|
|
238
|
+
const listSpecs = jest.fn(async () => [PLATFORM_SPEC])
|
|
239
|
+
await expect(resolveAppOnlySuiteRun(null, { commandEnvironment: {} }, listSpecs)).resolves.toBeNull()
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
it('keeps only the preflight specs that Playwright selects', async () => {
|
|
243
|
+
const listSpecs = jest.fn(async () => [SECOND_APP_SPEC, PLATFORM_SPEC])
|
|
244
|
+
const run = await resolveAppOnlySuiteRun([APP_SPEC, SECOND_APP_SPEC], { commandEnvironment: {} }, listSpecs)
|
|
245
|
+
expect(run?.fileFilters).toEqual(buildAppOnlyPlaywrightFileFilters([SECOND_APP_SPEC]))
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
describe('buildAppOnlyPlaywrightFileFilters', () => {
|
|
250
|
+
it('builds escaped, end-anchored file filters that match only the listed spec', () => {
|
|
251
|
+
const [filter] = buildAppOnlyPlaywrightFileFilters(['src/modules/orders/[id]/__integration__/TC-APP-001.spec.ts'])
|
|
252
|
+
const pattern = new RegExp(filter, 'gi')
|
|
253
|
+
expect(pattern.test('/repo/src/modules/orders/[id]/__integration__/TC-APP-001.spec.ts')).toBe(true)
|
|
254
|
+
pattern.lastIndex = 0
|
|
255
|
+
expect(pattern.test('/repo/src/modules/orders/[id]/__integration__/TC-APP-001.spec.tsx')).toBe(false)
|
|
256
|
+
pattern.lastIndex = 0
|
|
257
|
+
expect(pattern.test('/repo/xsrc/modules/orders/[id]/__integration__/TC-APP-001.spec.ts')).toBe(false)
|
|
258
|
+
})
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
describe('runIntegrationTestsInEphemeralEnvironment', () => {
|
|
262
|
+
it('exits cleanly before starting any environment when the app owns no specs', async () => {
|
|
263
|
+
const { runSuite } = createRunSuiteMock()
|
|
264
|
+
const discoverSpecs = jest.fn(async () => [{ path: PLATFORM_SPEC }])
|
|
265
|
+
|
|
266
|
+
await expect(
|
|
267
|
+
runIntegrationTestsInEphemeralEnvironment(['--app-only'], { discoverSpecs, runSuiteWithRecovery: runSuite }),
|
|
268
|
+
).resolves.toBeUndefined()
|
|
269
|
+
|
|
270
|
+
expect(discoverSpecs).toHaveBeenCalledTimes(1)
|
|
271
|
+
expect(runSuite).not.toHaveBeenCalled()
|
|
272
|
+
expect(logSpy).toHaveBeenCalledWith(NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE)
|
|
273
|
+
expect(NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE).toBe('No app-owned integration specs found')
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
it('passes only the app-owned spec list to the suite run', async () => {
|
|
277
|
+
const { runSuite, stop } = createRunSuiteMock()
|
|
278
|
+
const discoverSpecs = jest.fn(async () => [{ path: PLATFORM_SPEC }, { path: APP_SPEC }])
|
|
279
|
+
|
|
280
|
+
await runIntegrationTestsInEphemeralEnvironment(['--app-only'], { discoverSpecs, runSuiteWithRecovery: runSuite })
|
|
281
|
+
|
|
282
|
+
expect(runSuite).toHaveBeenCalledTimes(1)
|
|
283
|
+
expect(runSuite.mock.calls[0][1]).toMatchObject({ appOnly: true, appOnlySpecPaths: [APP_SPEC] })
|
|
284
|
+
expect(stop).toHaveBeenCalledTimes(1)
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
it('defers the empty-suite decision to the runtime when the config reports no selection', async () => {
|
|
288
|
+
const { runSuite } = createRunSuiteMock()
|
|
289
|
+
const discoverSpecs = jest.fn(async () => null)
|
|
290
|
+
|
|
291
|
+
await runIntegrationTestsInEphemeralEnvironment(['--app-only'], { discoverSpecs, runSuiteWithRecovery: runSuite })
|
|
292
|
+
|
|
293
|
+
expect(logSpy).not.toHaveBeenCalledWith(NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE)
|
|
294
|
+
expect(runSuite).toHaveBeenCalledTimes(1)
|
|
295
|
+
expect(runSuite.mock.calls[0][1]).toMatchObject({ appOnly: true, appOnlySpecPaths: null })
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
it('keeps the default run unchanged without the flag', async () => {
|
|
299
|
+
const { runSuite } = createRunSuiteMock()
|
|
300
|
+
const discoverSpecs = jest.fn(async () => [])
|
|
301
|
+
|
|
302
|
+
await runIntegrationTestsInEphemeralEnvironment(['orders'], { discoverSpecs, runSuiteWithRecovery: runSuite })
|
|
303
|
+
|
|
304
|
+
expect(discoverSpecs).not.toHaveBeenCalled()
|
|
305
|
+
expect(logSpy).not.toHaveBeenCalledWith(NO_APP_OWNED_INTEGRATION_SPECS_MESSAGE)
|
|
306
|
+
expect(runSuite).toHaveBeenCalledTimes(1)
|
|
307
|
+
expect(runSuite.mock.calls[0][1]).toMatchObject({ appOnly: false, filter: 'orders', appOnlySpecPaths: null })
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
it('prints usage that documents --app-only without starting anything', async () => {
|
|
311
|
+
const { runSuite } = createRunSuiteMock()
|
|
312
|
+
|
|
313
|
+
await runIntegrationTestsInEphemeralEnvironment(['--help'], { runSuiteWithRecovery: runSuite })
|
|
314
|
+
|
|
315
|
+
expect(runSuite).not.toHaveBeenCalled()
|
|
316
|
+
expect(logSpy).toHaveBeenCalledWith(INTEGRATION_TEST_USAGE)
|
|
317
|
+
expect(INTEGRATION_TEST_USAGE).toContain('--app-only')
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'node:os'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { mkdtemp, mkdir, rm, writeFile } from 'node:fs/promises'
|
|
4
|
-
import { discoverIntegrationSpecFiles } from '../integration-discovery'
|
|
4
|
+
import { discoverIntegrationSpecFiles, isAppOwnedIntegrationSpecPath } from '../integration-discovery'
|
|
5
5
|
|
|
6
6
|
async function writeTestFile(projectRoot: string, relativePath: string, content = 'export {}\n'): Promise<void> {
|
|
7
7
|
const absolutePath = path.join(projectRoot, relativePath)
|
|
@@ -17,6 +17,8 @@ describe('integration discovery', () => {
|
|
|
17
17
|
'OM_TEST_DISCOVERY_FALLBACK_AI_KEY',
|
|
18
18
|
'OM_TEST_DISCOVERY_REQUIRED_KEY',
|
|
19
19
|
'OM_TEST_APP_ROOT',
|
|
20
|
+
'OM_INTEGRATION_APP_ONLY',
|
|
21
|
+
'OM_INTEGRATION_SKIP_METADATA_FILTERS',
|
|
20
22
|
] as const
|
|
21
23
|
const previousTestEnvValues = new Map<string, string | undefined>()
|
|
22
24
|
|
|
@@ -331,4 +333,46 @@ describe('integration discovery', () => {
|
|
|
331
333
|
'packages/ai-assistant/src/modules/ai_assistant/__integration__/TC-AI-002.spec.ts',
|
|
332
334
|
])
|
|
333
335
|
})
|
|
336
|
+
|
|
337
|
+
it('keeps installed package specs by default and drops them when app-only discovery is enabled', async () => {
|
|
338
|
+
await writeTestFile(tempRoot, 'src/modules/orders/__integration__/TC-APP-001.spec.ts')
|
|
339
|
+
await writeTestFile(tempRoot, 'node_modules/@open-mercato/webhooks/src/modules/webhooks/__integration__/TC-WH-001.spec.ts')
|
|
340
|
+
|
|
341
|
+
const legacyRoot = path.join(tempRoot, '.ai', 'qa', 'tests')
|
|
342
|
+
expect(discoverIntegrationSpecFiles(tempRoot, legacyRoot).map((entry) => entry.path)).toEqual([
|
|
343
|
+
'node_modules/@open-mercato/webhooks/src/modules/webhooks/__integration__/TC-WH-001.spec.ts',
|
|
344
|
+
'src/modules/orders/__integration__/TC-APP-001.spec.ts',
|
|
345
|
+
])
|
|
346
|
+
|
|
347
|
+
process.env.OM_INTEGRATION_APP_ONLY = '1'
|
|
348
|
+
expect(discoverIntegrationSpecFiles(tempRoot, legacyRoot).map((entry) => entry.path)).toEqual([
|
|
349
|
+
'src/modules/orders/__integration__/TC-APP-001.spec.ts',
|
|
350
|
+
])
|
|
351
|
+
})
|
|
352
|
+
|
|
353
|
+
it('keeps a spec whose metadata the caller environment cannot satisfy when metadata filters are skipped', async () => {
|
|
354
|
+
await writeTestFile(tempRoot, 'src/modules/orders/__integration__/TC-APP-001.spec.ts')
|
|
355
|
+
await writeTestFile(
|
|
356
|
+
tempRoot,
|
|
357
|
+
'src/modules/orders/__integration__/meta.ts',
|
|
358
|
+
"export const integrationMeta = { dependsOnModules: ['missing_module'], requiredEnvVars: ['OM_TEST_DISCOVERY_REQUIRED_KEY'] }\n",
|
|
359
|
+
)
|
|
360
|
+
await writeTestFile(tempRoot, 'node_modules/@open-mercato/webhooks/src/modules/webhooks/__integration__/TC-WH-001.spec.ts')
|
|
361
|
+
const legacyRoot = path.join(tempRoot, '.ai', 'qa', 'tests')
|
|
362
|
+
process.env.OM_INTEGRATION_APP_ONLY = '1'
|
|
363
|
+
|
|
364
|
+
expect(discoverIntegrationSpecFiles(tempRoot, legacyRoot)).toEqual([])
|
|
365
|
+
|
|
366
|
+
process.env.OM_INTEGRATION_SKIP_METADATA_FILTERS = '1'
|
|
367
|
+
expect(discoverIntegrationSpecFiles(tempRoot, legacyRoot).map((entry) => entry.path)).toEqual([
|
|
368
|
+
'src/modules/orders/__integration__/TC-APP-001.spec.ts',
|
|
369
|
+
])
|
|
370
|
+
})
|
|
371
|
+
|
|
372
|
+
it('classifies spec paths under node_modules as not app-owned', () => {
|
|
373
|
+
expect(isAppOwnedIntegrationSpecPath('src/modules/orders/__integration__/TC-APP-001.spec.ts')).toBe(true)
|
|
374
|
+
expect(isAppOwnedIntegrationSpecPath('.ai/qa/tests/TC-APP-002.spec.ts')).toBe(true)
|
|
375
|
+
expect(isAppOwnedIntegrationSpecPath('node_modules/@open-mercato/search/src/modules/search/__integration__/TC-S-001.spec.ts')).toBe(false)
|
|
376
|
+
expect(isAppOwnedIntegrationSpecPath('packages/app/node_modules/x/__integration__/TC-X-001.spec.ts')).toBe(false)
|
|
377
|
+
})
|
|
334
378
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import ts from 'typescript-js'
|
|
4
4
|
|
|
@@ -32,6 +32,9 @@ const INTEGRATION_META_DEPENDENCY_KEYS = ['dependsOnModules', 'requiredModules',
|
|
|
32
32
|
const INTEGRATION_META_REQUIRED_ENV_KEYS = ['requiredEnvVars', 'requiresEnvVars'] as const
|
|
33
33
|
const INTEGRATION_META_REQUIRED_ANY_ENV_KEYS = ['requiredAnyEnvVars', 'requiresAnyEnvVars'] as const
|
|
34
34
|
const DEFAULT_OVERLAY_ROOT = 'packages/enterprise'
|
|
35
|
+
export const APP_ONLY_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_APP_ONLY'
|
|
36
|
+
export const SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_SKIP_METADATA_FILTERS'
|
|
37
|
+
export const DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR = 'OM_INTEGRATION_DISCOVERY_SELECTION_REPORT'
|
|
35
38
|
|
|
36
39
|
export function normalizePath(filePath: string): string {
|
|
37
40
|
return filePath.split(path.sep).join('/')
|
|
@@ -46,6 +49,26 @@ function isEnterpriseModulesEnabled(): boolean {
|
|
|
46
49
|
return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
function isAppOnlyDiscoveryEnabled(): boolean {
|
|
53
|
+
const rawValue = process.env[APP_ONLY_INTEGRATION_ENV_VAR]?.trim().toLowerCase()
|
|
54
|
+
return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isMetadataFilteringDisabled(): boolean {
|
|
58
|
+
const rawValue = process.env[SKIP_METADATA_FILTERS_INTEGRATION_ENV_VAR]?.trim().toLowerCase()
|
|
59
|
+
return rawValue === 'true' || rawValue === '1' || rawValue === 'yes' || rawValue === 'on'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function isAppOwnedIntegrationSpecPath(relativePath: string): boolean {
|
|
63
|
+
return !normalizePath(relativePath).split('/').includes('node_modules')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function writeDiscoverySelectionReport(projectRoot: string, files: readonly IntegrationSpecDiscoveryItem[]): void {
|
|
67
|
+
const reportFile = process.env[DISCOVERY_SELECTION_REPORT_INTEGRATION_ENV_VAR]?.trim()
|
|
68
|
+
if (!reportFile) return
|
|
69
|
+
writeFileSync(reportFile, JSON.stringify({ projectRoot, paths: files.map((file) => file.path) }))
|
|
70
|
+
}
|
|
71
|
+
|
|
49
72
|
function collectNamedDirectories(rootPath: string, directoryName: string): string[] {
|
|
50
73
|
let entries
|
|
51
74
|
try {
|
|
@@ -457,11 +480,12 @@ export function discoverIntegrationSpecFiles(projectRoot: string, legacyIntegrat
|
|
|
457
480
|
const discoveredByPath = new Map<string, IntegrationSpecDiscoveryItem>()
|
|
458
481
|
const overlayRoot = resolveOverlayRootPath()
|
|
459
482
|
const enterpriseEnabled = isEnterpriseModulesEnabled()
|
|
483
|
+
const appOnly = isAppOnlyDiscoveryEnabled()
|
|
460
484
|
const discoveryRoots = [
|
|
461
485
|
path.join(projectRoot, 'src', 'modules'),
|
|
462
486
|
path.join(projectRoot, 'apps'),
|
|
463
487
|
path.join(projectRoot, 'packages'),
|
|
464
|
-
path.join(projectRoot, 'node_modules', '@open-mercato'),
|
|
488
|
+
...(appOnly ? [] : [path.join(projectRoot, 'node_modules', '@open-mercato')]),
|
|
465
489
|
]
|
|
466
490
|
|
|
467
491
|
for (const specFile of collectSpecFilesFromDirectory(legacyIntegrationRoot)) {
|
|
@@ -493,6 +517,12 @@ export function discoverIntegrationSpecFiles(projectRoot: string, legacyIntegrat
|
|
|
493
517
|
}
|
|
494
518
|
|
|
495
519
|
const discovered = Array.from(discoveredByPath.values())
|
|
520
|
+
.filter((file) => !appOnly || isAppOwnedIntegrationSpecPath(file.path))
|
|
521
|
+
if (isMetadataFilteringDisabled()) {
|
|
522
|
+
const selected = discovered.sort((left, right) => left.path.localeCompare(right.path))
|
|
523
|
+
writeDiscoverySelectionReport(projectRoot, selected)
|
|
524
|
+
return selected
|
|
525
|
+
}
|
|
496
526
|
const enabledModules = resolveEnabledModuleIds(projectRoot)
|
|
497
527
|
const testAppRoot = resolveTestAppRoot()
|
|
498
528
|
const testAppModules = testAppRoot ? resolvePossiblyEnabledTestAppModuleIds(testAppRoot) : null
|