diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba59e244e..2e99e039f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -640,6 +640,17 @@ jobs: playwright-${{ runner.os }}- - run: npx playwright install --with-deps chromium - run: npx nx e2e website --skip-nx-cache + # The production-smoke spec is testIgnore'd outside PRODUCTION_SMOKE mode, + # so a module-load error in it is invisible until the post-merge Production + # smoke job runs against main — too late to gate a PR. Collect it here: + # --list loads every spec without hitting production. + - name: Production-smoke spec must load + env: + PRODUCTION_SMOKE: 'true' + BASE_URL: https://threadplane.ai + run: | + npx playwright test apps/website/e2e/platform-production-smoke.spec.ts \ + --config apps/website/playwright.config.ts --list required-pr-checks: name: CI — required diff --git a/apps/website/e2e/platform-production-smoke.spec.ts b/apps/website/e2e/platform-production-smoke.spec.ts index da9799740..9e6f5d67a 100644 --- a/apps/website/e2e/platform-production-smoke.spec.ts +++ b/apps/website/e2e/platform-production-smoke.spec.ts @@ -1,5 +1,6 @@ import { expect, test } from '@playwright/test'; import { readFileSync } from 'node:fs'; +import { join } from 'node:path'; import { validateRuntimeParentOrigins } from '@threadplane/cockpit-runtime-bridge'; import { cockpitManifest, @@ -30,11 +31,12 @@ const EXAMPLES_URL = process.env['EXAMPLES_URL'] ?? 'https://examples.threadplane.ai'; const DEMO_URL = process.env['DEMO_URL'] ?? 'https://demo.threadplane.ai'; const WEBSITE_URL = process.env['WEBSITE_URL'] ?? 'https://threadplane.ai'; +// Playwright transpiles specs to CJS, so `import.meta.url` here compiles to a +// `require` the ESM-loaded output cannot resolve and the whole file fails to +// load. `__dirname` is what the emitted module actually has. Don't "modernise" +// this back to import.meta.url. const runtimeParentOriginSource = JSON.parse( - readFileSync( - new URL('../../../runtime-parent-origins.json', import.meta.url), - 'utf8' - ) + readFileSync(join(__dirname, '../../../runtime-parent-origins.json'), 'utf8') ) as { readonly baseOrigins?: unknown }; const runtimeParentPreviewOrigins = ( process.env['RUNTIME_PARENT_PREVIEW_ORIGINS'] ?? ''