Tests: boot Payload without type generation, guard against the leak

Outside production getPayload() spawns a detached generate:types child.
With no PAYLOAD_CONFIG_PATH it never finds a config (tsconfig rootDir
'./' sends Payload's findUpSync into an endless loop), so every full
vitest run left six processes spinning at ~40% CPU.

- test/helpers.ts: buildTestConfig() = buildConfig with
  typescript.autoGenerate false
- the six tests that boot Payload use it
- test/testConfig.test.ts: fails if a test calls buildConfig directly

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-27 14:59:41 +01:00
co-authored by Claude Opus 5.5
parent e53d09b720
commit 53a8920564
8 changed files with 56 additions and 14 deletions
+3 -2
View File
@@ -4,11 +4,12 @@ import { sqliteAdapter } from '@payloadcms/db-sqlite'
import { lexicalEditor } from '@payloadcms/richtext-lexical'
import os from 'node:os'
import path from 'node:path'
import { buildConfig, getPayload } from 'payload'
import { getPayload } from 'payload'
import { afterAll, beforeAll, describe, expect, test, vi } from 'vitest'
import { createContentHelpers } from '../src/modules/frontend/createContentHelpers.js'
import { ipalKit } from '../src/plugin.js'
import { buildTestConfig } from './helpers.js'
vi.mock('server-only', () => ({}))
@@ -25,7 +26,7 @@ describe('SEO outputs against a real database', () => {
const urls = async () => (await helpers().sitemap()).map((e) => e.url).sort()
beforeAll(async () => {
configPromise = buildConfig({
configPromise = buildTestConfig({
collections: [
{ slug: 'users', auth: true, fields: [] },
{