From 8e125799252d3219b7a24e7ee936548154f9f9b5 Mon Sep 17 00:00:00 2001 From: agent_vscode Date: Mon, 6 Jul 2026 00:36:31 +0300 Subject: [PATCH] fix(ci): transform ESM @docmost/prosemirror-markdown in server int/e2e jest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The develop build failed in two jobs, both rooted in the ESM-only workspace package @docmost/prosemirror-markdown (type: module, built to build/index.js with `export * from`), which the server imports at runtime (collaboration.util, page.service). Refactor #345 taught only the unit jest config (package.json "jest" key) to consume it, leaving the integration and e2e configs — and the e2e-server CI job — broken: - `pnpm --filter server test:int` -> SyntaxError: Unexpected token 'export' (jest did not transform prosemirror-markdown/build/*.js). - e2e-server job -> TS2307 Cannot find module '@docmost/prosemirror-markdown' (the package was never built in that job). Mirror the proven unit config into the two failing jest configs and add the missing build step: - jest-integration.json / jest-e2e.json: add a babel-jest transform rule for `prosemirror-markdown/build/.+\.js$` (before the ts-jest rule so it wins) and add @docmost/prosemirror-markdown to the transformIgnorePatterns allowlist so the pnpm-symlinked package is transformed instead of ignored. - develop.yml: build @docmost/prosemirror-markdown in the e2e-server job (after editor-ext, before migrations), like the test.yml job already does. Verified locally: an isolated spec importing the package fails with the exact SyntaxError under the old config and passes under the new one. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/develop.yml | 6 ++++++ apps/server/test/jest-e2e.json | 6 +++++- apps/server/test/jest-integration.json | 6 +++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index d61bd006..1d12b37a 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -151,6 +151,12 @@ jobs: - name: Build editor-ext run: pnpm --filter @docmost/editor-ext build + # @docmost/prosemirror-markdown is an ESM workspace package the server + # imports at runtime; its build/ is gitignored and test:e2e has no pretest + # hook, so build it before the e2e run (mirrors the test.yml job). + - name: Build prosemirror-markdown + run: pnpm --filter @docmost/prosemirror-markdown build + - name: Run migrations run: pnpm --filter ./apps/server migration:latest diff --git a/apps/server/test/jest-e2e.json b/apps/server/test/jest-e2e.json index c7a61c13..2d696eb7 100644 --- a/apps/server/test/jest-e2e.json +++ b/apps/server/test/jest-e2e.json @@ -4,10 +4,14 @@ "testEnvironment": "node", "testRegex": ".e2e-spec.ts$", "transform": { + "prosemirror-markdown/build/.+\\.js$": [ + "babel-jest", + { "presets": [["@babel/preset-env", { "targets": { "node": "current" } }]] } + ], "^.+\\.(t|j)sx?$": ["ts-jest", { "tsconfig": { "allowJs": true } }] }, "transformIgnorePatterns": [ - "/node_modules/(?!(\\.pnpm/)?(nanoid|uuid|image-dimensions|marked|happy-dom|lib0|@sindresorhus[+/][a-z0-9-]+|escape-string-regexp|p-limit|yocto-queue)(@|/))" + "/node_modules/(?!(\\.pnpm/)?(nanoid|uuid|image-dimensions|marked|happy-dom|lib0|@sindresorhus[+/][a-z0-9-]+|escape-string-regexp|p-limit|yocto-queue|@docmost/prosemirror-markdown)(@|/))" ], "moduleNameMapper": { "^@docmost/db/(.*)$": "/../src/database/$1", diff --git a/apps/server/test/jest-integration.json b/apps/server/test/jest-integration.json index 1f42191e..30f62397 100644 --- a/apps/server/test/jest-integration.json +++ b/apps/server/test/jest-integration.json @@ -4,10 +4,14 @@ "testRegex": ".*\\.int-spec\\.ts$", "testPathIgnorePatterns": ["/node_modules/"], "transform": { + "prosemirror-markdown/build/.+\\.js$": [ + "babel-jest", + { "presets": [["@babel/preset-env", { "targets": { "node": "current" } }]] } + ], "^.+\\.(t|j)sx?$": "ts-jest" }, "transformIgnorePatterns": [ - "/node_modules/(?!(\\.pnpm/)?(nanoid|uuid|image-dimensions|marked|happy-dom|lib0)(@|/))" + "/node_modules/(?!(\\.pnpm/)?(nanoid|uuid|image-dimensions|marked|happy-dom|lib0|@docmost/prosemirror-markdown)(@|/))" ], "testEnvironment": "node", "testTimeout": 60000,