const { Photon } = require('@prisma/photon')

module.exports = async () => {
  const photon = new Photon({
    errorFormat: 'colorless',
  })
  await photon.users()
  photon.disconnect()
  await photon.users()
  photon.disconnect()
  photon.connect()
  await photon.disconnect()
  await new Promise(r => setTimeout(r, 200))
  photon.connect()
  await photon.users()
}

const { Photon } = require('@prisma/photon')

module.exports = async () => {
  const photon = new Photon({
    errorFormat: 'colorless',
    __internal: {
      measurePerformance: true
    }
  })
  await photon.users()
  photon.disconnect()
  await photon.users()
  photon.disconnect()
  photon.connect()
  await photon.disconnect()
  await new Promise(r => setTimeout(r, 200))
  photon.connect()

  const userPromise = photon.users()
  await userPromise
  // @ts-ignore
  const perfResults = userPromise._collectTimestamps.getResults()
  if (Object.keys(perfResults).length === 0) {
    throw Error("measurePerformance is enabled but results object is empty")
  }
}

Add test for __internal.measurePerformance boolean
Add test for __internal.measurePerformance boolean


Former-commit-id: 4c4154a641998aa89653a1bd330f18fa09cd7e8b
Former-commit-id: b4fe0e5b1511d073c8e1cba8294e746b976a03cd