chore: remove console logs

This commit is contained in:
Alessio Gravili
2024-04-02 12:29:38 -04:00
parent cc5c2bd7cd
commit 4ff7619356
4 changed files with 0 additions and 64 deletions

View File

@@ -36,7 +36,6 @@ import { localAPIEndpoint } from './helpers/sdk/endpoint.js'
export async function buildConfigWithDefaults(
testConfig?: Partial<Config>,
): Promise<SanitizedConfig> {
console.log('Using', process.env.MONGODB_MEMORY_SERVER_URI)
const databaseAdapters = {
mongodb: mongooseAdapter({
url:

View File

@@ -1,54 +0,0 @@
import type { DatabaseAdapterObj } from 'payload/database'
import { mongooseAdapter } from '@payloadcms/db-mongodb'
import { MongoMemoryReplSet } from 'mongodb-memory-server'
let cached: {
adapter: DatabaseAdapterObj | null
promise: Promise<DatabaseAdapterObj> | null
} = global._cachedDBAdapter
if (!cached) {
// eslint-disable-next-line no-multi-assign
cached = global._cachedDBAdapter = {
promise: null,
adapter: null,
}
}
export const getDBAdapter = async (): Promise<DatabaseAdapterObj> => {
if (!process.env.PAYLOAD_DATABASE || process.env.PAYLOAD_DATABASE === 'mongodb') {
if (process.env.JEST_WORKER_ID || process.env.PW_TS_ESM_LOADER_ON) {
console.log('Good: Using in-memory MongoDB for tests')
if (cached.adapter) {
console.log('MDB: Cached')
return cached.adapter
}
if (!cached.promise) {
console.log('MDB: Creating')
cached.promise = MongoMemoryReplSet.create({
replSet: {
count: 3,
dbName: 'payloadmemory',
},
}).then((server) => {
const url = server.getUri()
return mongooseAdapter({
mongoMemoryServer: server,
url,
})
})
}
console.log('MDB: Awaiting')
cached.adapter = await cached.promise
return cached.adapter
} else {
console.log('Bad1!!')
}
} else {
console.log('Bad2!!')
}
return cached.adapter
}

View File

@@ -7,12 +7,6 @@ export default async () => {
process.env.PAYLOAD_DROP_DATABASE = 'true'
process.env.NODE_OPTIONS = '--no-deprecation'
console.log(
'Inside startMemoryDB',
process.env.PAYLOAD_DATABASE,
process.env.PAYLOAD_DATABASE === 'mongodb',
)
if (
(!process.env.PAYLOAD_DATABASE || process.env.PAYLOAD_DATABASE === 'mongodb') &&
!global._mongoMemoryServer
@@ -25,7 +19,5 @@ export default async () => {
})
process.env.MONGODB_MEMORY_SERVER_URI = global._mongoMemoryServer.getUri()
console.log('Started mongo memory DB. URI:', process.env.MONGODB_MEMORY_SERVER_URI)
}
}

View File

@@ -429,7 +429,6 @@ describe('versions', () => {
await saveDocAndAssert(page)
// create and save second doc
console.log('Goto autosaveURL.create', autosaveURL.create)
await page.goto(autosaveURL.create)
// Should redirect from /create to /[collectionslug]/[new id] due to auto-save
await page.waitForURL(`${autosaveURL.list}/**`)