build(proto): mark the package as ESM so the Payload CLI loads the config (MITHOME-136)
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
The Payload CLI failed with ERR_REQUIRE_ASYNC_MODULE on Node 22 and 26 alike: without "type": "module" it loaded payload.config.ts as CommonJS and could not require the top-level-await ESM @payloadcms/richtext-lexical. Following the official Payload template: "type": "module", CommonJS jest files and the content schema renamed to .cjs, ESLint globs updated. Next's standalone server.js is ESM and starts; 516 unit tests, tsc, lint and build are green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
66b169cf06
commit
a3d6cbe404
@@ -29,9 +29,11 @@ const eslintConfig = [
|
||||
files: [
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"jest.config*.js",
|
||||
"jest.setup*.js",
|
||||
"jest.globalSetup*.js",
|
||||
// MITHOME-136: package is "type": "module", so the CommonJS jest files are .cjs.
|
||||
"jest.config*.cjs",
|
||||
"jest.setup*.cjs",
|
||||
"jest.globalSetup*.cjs",
|
||||
"jest.globalTeardown*.cjs",
|
||||
"playwright.config.ts",
|
||||
],
|
||||
rules: {
|
||||
|
||||
@@ -7,7 +7,7 @@ const createJestConfig = nextJest({
|
||||
|
||||
// Add any custom config to be passed to Jest
|
||||
const customJestConfig = {
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases (this will be automatically configured for you based on your tsconfig.json paths)
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
@@ -8,7 +8,7 @@ const createJestConfig = nextJest({
|
||||
// Integration tests configuration - runs in Node.js environment with fetch polyfill
|
||||
const integrationJestConfig = {
|
||||
displayName: 'Integration Tests',
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.integration.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.integration.cjs'],
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
@@ -19,8 +19,8 @@ const integrationJestConfig = {
|
||||
'<rootDir>/src/__tests__/e2e-docker.test.ts'
|
||||
],
|
||||
testTimeout: 30000, // Longer timeout for integration tests
|
||||
globalSetup: '<rootDir>/jest.globalSetup.integration.js',
|
||||
globalTeardown: '<rootDir>/jest.globalTeardown.integration.js'
|
||||
globalSetup: '<rootDir>/jest.globalSetup.integration.cjs',
|
||||
globalTeardown: '<rootDir>/jest.globalTeardown.integration.cjs'
|
||||
}
|
||||
|
||||
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
|
||||
@@ -8,7 +8,7 @@ const createJestConfig = nextJest({
|
||||
// Unit tests configuration - runs in Node.js environment
|
||||
const unitJestConfig = {
|
||||
displayName: 'Unit Tests',
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.cjs'],
|
||||
moduleNameMapper: {
|
||||
// Handle module aliases
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
+8
-7
@@ -2,18 +2,19 @@
|
||||
"name": "proto",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build --turbopack",
|
||||
"start": "next start",
|
||||
"lint": "eslint",
|
||||
"test": "jest --config jest.config.unit.js",
|
||||
"test:watch": "jest --config jest.config.unit.js --watch",
|
||||
"test:coverage": "jest --config jest.config.unit.js --coverage",
|
||||
"test:unit": "jest --config jest.config.unit.js",
|
||||
"test:browser": "jest --config jest.config.js src/__tests__/browser-integration.test.ts",
|
||||
"test:integration": "INTEGRATION_TESTS=1 jest --config jest.config.integration.js src/__tests__/integration.test.ts",
|
||||
"test:e2e": "E2E_TESTS=1 jest --config jest.config.integration.js src/__tests__/e2e-docker.test.ts",
|
||||
"test": "jest --config jest.config.unit.cjs",
|
||||
"test:watch": "jest --config jest.config.unit.cjs --watch",
|
||||
"test:coverage": "jest --config jest.config.unit.cjs --coverage",
|
||||
"test:unit": "jest --config jest.config.unit.cjs",
|
||||
"test:browser": "jest --config jest.config.cjs src/__tests__/browser-integration.test.ts",
|
||||
"test:integration": "INTEGRATION_TESTS=1 jest --config jest.config.integration.cjs src/__tests__/integration.test.ts",
|
||||
"test:e2e": "E2E_TESTS=1 jest --config jest.config.integration.cjs src/__tests__/e2e-docker.test.ts",
|
||||
"test:smoke:staging": "playwright test --config=playwright.config.ts --project=staging",
|
||||
"test:seo:production": "playwright test --config=playwright.config.ts --project=production-seo",
|
||||
"test:docker": "npm run test:integration && npm run test:e2e",
|
||||
|
||||
@@ -23,7 +23,7 @@ import type {
|
||||
ContactPageContent,
|
||||
LegalPageContent
|
||||
} from './types'
|
||||
import { validateContent } from './schema'
|
||||
import { validateContent } from './schema.cjs'
|
||||
|
||||
// Import JSON files
|
||||
import commonJson from './common.json'
|
||||
|
||||
Reference in New Issue
Block a user