chore: unit/int test CI stuff
This commit is contained in:
46
.github/workflows/main.yml
vendored
46
.github/workflows/main.yml
vendored
@@ -201,6 +201,12 @@ jobs:
|
|||||||
echo "POSTGRES_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres" >> $GITHUB_ENV
|
echo "POSTGRES_URL=postgresql://postgres:postgres@127.0.0.1:54322/postgres" >> $GITHUB_ENV
|
||||||
if: matrix.database == 'supabase'
|
if: matrix.database == 'supabase'
|
||||||
|
|
||||||
|
- name: Unit Tests
|
||||||
|
if: false # Disable until tests are updated for 3.0
|
||||||
|
run: pnpm test:unit
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --max-old-space-size=8096
|
||||||
|
|
||||||
- name: Integration Tests
|
- name: Integration Tests
|
||||||
run: pnpm test:int
|
run: pnpm test:int
|
||||||
env:
|
env:
|
||||||
@@ -292,46 +298,6 @@ jobs:
|
|||||||
- name: Generate GraphQL schema file
|
- name: Generate GraphQL schema file
|
||||||
run: pnpm dev:generate-graphql-schema graphql-schema-gen
|
run: pnpm dev:generate-graphql-schema graphql-schema-gen
|
||||||
|
|
||||||
plugins:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: core-build
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
pkg:
|
|
||||||
- create-payload-app
|
|
||||||
- plugin-cloud
|
|
||||||
- plugin-cloud-storage
|
|
||||||
- plugin-form-builder
|
|
||||||
- plugin-nested-docs
|
|
||||||
- plugin-search
|
|
||||||
- plugin-sentry
|
|
||||||
- plugin-seo
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Use Node.js 18
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
|
|
||||||
- name: Install pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
run_install: false
|
|
||||||
|
|
||||||
- name: Restore build
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ./*
|
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
|
||||||
|
|
||||||
- name: Build ${{ matrix.pkg }}
|
|
||||||
run: pnpm turbo run build --filter=${{ matrix.pkg }}
|
|
||||||
|
|
||||||
- name: Test ${{ matrix.pkg }}
|
|
||||||
run: pnpm --filter ${{ matrix.pkg }} run test
|
|
||||||
|
|
||||||
templates:
|
templates:
|
||||||
needs: changes
|
needs: changes
|
||||||
if: false # Disable until templates are updated for 3.0
|
if: false # Disable until templates are updated for 3.0
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** @type {import('jest').Config} */
|
/** @type {import('jest').Config} */
|
||||||
const customJestConfig = {
|
const baseJestConfig = {
|
||||||
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
||||||
setupFilesAfterEnv: ['<rootDir>/test/jest.setup.ts'],
|
setupFilesAfterEnv: ['<rootDir>/test/jest.setup.ts'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
@@ -8,9 +8,8 @@ const customJestConfig = {
|
|||||||
'<rootDir>/test/helpers/mocks/fileMock.js',
|
'<rootDir>/test/helpers/mocks/fileMock.js',
|
||||||
'^(\\.{1,2}/.*)\\.js$': '$1',
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
||||||
},
|
},
|
||||||
reporters: ['default', ['github-actions', { silent: false }], 'summary'],
|
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
testMatch: ['<rootDir>/packages/payload/src/**/*.spec.ts', '<rootDir>/test/**/*int.spec.ts'],
|
testMatch: ['<rootDir>/packages/*/src/**/*.spec.ts'],
|
||||||
testTimeout: 90000,
|
testTimeout: 90000,
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.(t|j)sx?$': ['@swc/jest'],
|
'^.+\\.(t|j)sx?$': ['@swc/jest'],
|
||||||
@@ -19,7 +18,7 @@ const customJestConfig = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
customJestConfig.reporters = [['github-actions', { silent: false }], 'summary']
|
baseJestConfig.reporters = [['github-actions', { silent: false }], 'summary']
|
||||||
}
|
}
|
||||||
|
|
||||||
export default customJestConfig
|
export default baseJestConfig
|
||||||
|
|||||||
@@ -66,8 +66,9 @@
|
|||||||
"test:e2e": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 tsx ./test/runE2E.ts",
|
"test:e2e": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 tsx ./test/runE2E.ts",
|
||||||
"test:e2e:debug": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PWDEBUG=1 DISABLE_LOGGING=true playwright test",
|
"test:e2e:debug": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PWDEBUG=1 DISABLE_LOGGING=true playwright test",
|
||||||
"test:e2e:headed": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true playwright test --headed",
|
"test:e2e:headed": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true playwright test --headed",
|
||||||
"test:int:postgres": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PAYLOAD_DATABASE=postgres DISABLE_LOGGING=true jest --forceExit --detectOpenHandles",
|
"test:int:postgres": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 PAYLOAD_DATABASE=postgres DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=jest.config.js",
|
||||||
"test:int": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true jest --forceExit --detectOpenHandles",
|
"test:int": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=test/jest.config.js",
|
||||||
|
"test:unit": "cross-env NODE_OPTIONS=--no-deprecation NODE_NO_WARNINGS=1 DISABLE_LOGGING=true jest --forceExit --detectOpenHandles --config=jest.config.js",
|
||||||
"translateNewKeys": "pnpm --filter payload run translateNewKeys"
|
"translateNewKeys": "pnpm --filter payload run translateNewKeys"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"types": "./src/types.ts",
|
"types": "./src/types.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm build:swc && pnpm build:types",
|
"build": "pnpm build:swc && pnpm build:types",
|
||||||
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc-build",
|
||||||
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
||||||
"clean": "rimraf {dist,*.tsbuildinfo}",
|
"clean": "rimraf {dist,*.tsbuildinfo}",
|
||||||
"prepublishOnly": "pnpm clean && pnpm turbo build"
|
"prepublishOnly": "pnpm clean && pnpm turbo build"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/swcrc",
|
"$schema": "https://json.schemastore.org/swcrc",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"exclude": ["/**/mocks"],
|
"exclude": ["/**/mocks", "/**/*.spec.ts"],
|
||||||
"jsc": {
|
"jsc": {
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"parser": {
|
"parser": {
|
||||||
@@ -6,6 +6,27 @@ const customJestConfig = {
|
|||||||
setupFilesAfterEnv: null,
|
setupFilesAfterEnv: null,
|
||||||
testMatch: ['**/src/**/?(*.)+(spec|test|it-test).[tj]s?(x)'],
|
testMatch: ['**/src/**/?(*.)+(spec|test|it-test).[tj]s?(x)'],
|
||||||
testTimeout: 20000,
|
testTimeout: 20000,
|
||||||
|
transform: {
|
||||||
|
'^.+\\.(t|j)sx?$': [
|
||||||
|
'@swc/jest',
|
||||||
|
{
|
||||||
|
$schema: 'https://json.schemastore.org/swcrc',
|
||||||
|
sourceMaps: true,
|
||||||
|
exclude: ['/**/mocks'],
|
||||||
|
jsc: {
|
||||||
|
target: 'esnext',
|
||||||
|
parser: {
|
||||||
|
syntax: 'typescript',
|
||||||
|
tsx: true,
|
||||||
|
dts: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
type: 'es6',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default customJestConfig
|
export default customJestConfig
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "pnpm build:swc && pnpm build:types",
|
"build": "pnpm build:swc && pnpm build:types",
|
||||||
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc-build",
|
||||||
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
||||||
"clean": "rimraf {dist,*.tsbuildinfo} && rimraf dev/yarn.lock",
|
"clean": "rimraf {dist,*.tsbuildinfo} && rimraf dev/yarn.lock",
|
||||||
"prepublishOnly": "pnpm clean && pnpm turbo build",
|
"prepublishOnly": "pnpm clean && pnpm turbo build",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/swcrc",
|
"$schema": "https://json.schemastore.org/swcrc",
|
||||||
"sourceMaps": true,
|
"sourceMaps": true,
|
||||||
"exclude": ["/**/*.spec.ts"],
|
"exclude": ["/**/mocks", "/**/*.spec.ts"],
|
||||||
"jsc": {
|
"jsc": {
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"parser": {
|
"parser": {
|
||||||
@@ -6,6 +6,27 @@ const customJestConfig = {
|
|||||||
setupFilesAfterEnv: null,
|
setupFilesAfterEnv: null,
|
||||||
testMatch: ['**/src/**/?(*.)+(spec|test|it-test).[tj]s?(x)'],
|
testMatch: ['**/src/**/?(*.)+(spec|test|it-test).[tj]s?(x)'],
|
||||||
testTimeout: 20000,
|
testTimeout: 20000,
|
||||||
|
transform: {
|
||||||
|
'^.+\\.(t|j)sx?$': [
|
||||||
|
'@swc/jest',
|
||||||
|
{
|
||||||
|
$schema: 'https://json.schemastore.org/swcrc',
|
||||||
|
sourceMaps: true,
|
||||||
|
exclude: ['/**/mocks'],
|
||||||
|
jsc: {
|
||||||
|
target: 'esnext',
|
||||||
|
parser: {
|
||||||
|
syntax: 'typescript',
|
||||||
|
tsx: true,
|
||||||
|
dts: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
type: 'es6',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default customJestConfig
|
export default customJestConfig
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "echo \"Build temporarily disabled.\" && exit 0",
|
"build": "echo \"Build temporarily disabled.\" && exit 0",
|
||||||
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc-build",
|
||||||
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
||||||
"clean": "rimraf {dist,*.tsbuildinfo}",
|
"clean": "rimraf {dist,*.tsbuildinfo}",
|
||||||
"prepublishOnly": "pnpm clean && pnpm turbo build"
|
"prepublishOnly": "pnpm clean && pnpm turbo build"
|
||||||
|
|||||||
@@ -1,28 +1,29 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
import jestBaseConfig from '../jest.config.js'
|
||||||
|
|
||||||
const filename = fileURLToPath(import.meta.url)
|
const filename = fileURLToPath(import.meta.url)
|
||||||
const dirname = path.dirname(filename)
|
const dirname = path.dirname(filename)
|
||||||
|
|
||||||
/** @type {import('jest').Config} */
|
/** @type {import('jest').Config} */
|
||||||
const customJestConfig = {
|
const customJestConfig = {
|
||||||
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
...jestBaseConfig,
|
||||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
testMatch: ['<rootDir>/**/*int.spec.ts'],
|
||||||
|
setupFilesAfterEnv: [
|
||||||
|
//path.resolve(dirname, './helpers/startMemoryDB.ts'),
|
||||||
|
'<rootDir>/jest.setup.ts',
|
||||||
|
],
|
||||||
|
globalSetup: path.resolve(dirname, './helpers/startMemoryDB.ts'),
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'\\.(css|scss)$': '<rootDir>/helpers/mocks/emptyModule.js',
|
'\\.(css|scss)$': '<rootDir>/helpers/mocks/emptyModule.js',
|
||||||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
||||||
'<rootDir>/test/helpers/mocks/fileMock.js',
|
'<rootDir>/helpers/mocks/fileMock.js',
|
||||||
'^(\\.{1,2}/.*)\\.js$': '$1',
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
||||||
},
|
},
|
||||||
reporters: ['default', ['github-actions', { silent: false }], 'summary'],
|
}
|
||||||
testEnvironment: 'node',
|
|
||||||
globalSetup: path.resolve(dirname, './helpers/startMemoryDB.ts'),
|
if (process.env.CI) {
|
||||||
testMatch: ['<rootDir>/**/*int.spec.ts'],
|
customJestConfig.reporters = [['github-actions', { silent: false }], 'summary']
|
||||||
testTimeout: 90000,
|
|
||||||
transform: {
|
|
||||||
'^.+\\.(t|j)sx?$': ['@swc/jest'],
|
|
||||||
},
|
|
||||||
verbose: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default customJestConfig
|
export default customJestConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user