Skip to content

Commit ff748e1

Browse files
authored
Fixed the Node test matrix running every leg on the same Node version (#30435)
no ref pnpm installs the Node pinned by `devEngines.runtime` and links its bin ahead of the one setup-node installs, so both legs of the unit, legacy and acceptance matrices ran 22.23.1 and the Node 24 legs proved nothing. Passing `--no-runtime` to those installs skips the runtime dependency, so each leg runs the version its matrix entry asked for. That makes two genuine Node 24 failures visible, fixed here so the matrix goes green on both legs: - `res._headers` was removed in Node 24, so the mock-express helper handed every assertion an undefined headers object. - Node 24 adds a literal `module.exports` key to a CJS module's namespace. The external-globals plugin re-exports every key, emitting `export const module.exports = React.module.exports;`, which rolldown rejects and which failed every admin build.
1 parent 1568a7c commit ff748e1

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,9 @@ jobs:
554554
with:
555555
node-version: ${{ env.NODE_VERSION }}
556556
trust-lockfile: 'true'
557-
# --force for the same reason as job_unit-tests: better-sqlite3 is an
558-
# optionalDependency and boot uses it for the development database.
557+
# better-sqlite3 is an optionalDependency that pnpm may skip when
558+
# restoring from a cached store, and boot needs it for the
559+
# development database.
559560
install-args: --force
560561

561562
- name: Install hyperfine
@@ -693,11 +694,9 @@ jobs:
693694
with:
694695
node-version: ${{ matrix.node }}
695696
trust-lockfile: 'true'
696-
# better-sqlite3 is an optionalDependency. Without --force, pnpm may skip
697-
# installing/linking it when restoring from a cached store. --force
698-
# ensures all optional deps are installed regardless.
699-
# (ghost core's test:unit job requires better-sqlite3)
700-
install-args: --force
697+
# Without --no-runtime, pnpm links the devEngines Node and every
698+
# leg of this matrix runs that same version.
699+
install-args: --no-runtime
701700

702701
- name: Set timezone (non-UTC)
703702
uses: szenius/set-timezone@1f9716b0f7120e344f0c62bb7b1ee98819aefd42 # v2.0
@@ -796,6 +795,9 @@ jobs:
796795
with:
797796
node-version: ${{ matrix.node }}
798797
trust-lockfile: 'true'
798+
# Without --no-runtime, pnpm links the devEngines Node and every
799+
# leg of this matrix runs that same version.
800+
install-args: --no-runtime
799801

800802
- name: Set timezone (non-UTC)
801803
uses: szenius/set-timezone@1f9716b0f7120e344f0c62bb7b1ee98819aefd42 # v2.0
@@ -900,6 +902,9 @@ jobs:
900902
with:
901903
node-version: ${{ matrix.node }}
902904
trust-lockfile: 'true'
905+
# Without --no-runtime, pnpm links the devEngines Node and every
906+
# leg of this matrix runs that same version.
907+
install-args: --no-runtime
903908

904909
- name: Set env vars (MySQL)
905910
run: |

apps/admin-x-framework/src/vite.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ const externalPlugin = ({ externals }: { externals: Record<string, string> }): P
2222
if (originalId) {
2323
const module = await import(originalId);
2424

25+
// Node 24 adds a literal `module.exports` key to a CJS namespace, which
26+
// is not a valid identifier to re-export.
2527
return Object.keys(module)
28+
.filter((key) => /^[A-Za-z_$][\w$]*$/.test(key))
2629
.map((key) =>
2730
key === 'default'
2831
? `export default ${externalName};`

ghost/core/test/legacy/mock-express-style/utils/mock-express.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
err: res.req.err,
3838
body: body,
3939
statusCode: res.statusCode,
40-
headers: res._headers,
40+
headers: res.getHeaders(),
4141
template: res._template,
4242
req: req,
4343
res: res,
@@ -49,7 +49,7 @@ module.exports = {
4949
err: res.req.err,
5050
body: body,
5151
statusCode: res.statusCode,
52-
headers: res._headers,
52+
headers: res.getHeaders(),
5353
template: res._template,
5454
req: req,
5555
res: res,

0 commit comments

Comments
 (0)