<commit_before>import { RustPanic, ErrorArea } from '@prisma/sdk'
import { handlePanic } from '@prisma/migrate'
import path from 'path'
import { Introspect } from '../Introspect'

async function main() {
  // process.env.GITHUB_ACTIONS = 'maybe'

  // const error = new RustPanic(
  //   'Some error message!\n'.repeat(23),
  //   '',
  //   undefined,
  //   ErrorArea.INTROSPECTION_CLI,
  //   path.resolve(path.join('fixtures', 'blog', 'prisma', 'schema.prisma')),
  // )

  const packageJsonVersion = '0.0.0'
  const prismaVersion = 'prismaVersionHash'

  // await handlePanic(error, packageJsonVersion, prismaVersion)
  //   .catch((e) => {
  //     console.log(e)
  //   })
  //   .finally(() => {
  //     process.exit(1)
  //   })

  try {
    // process.chdir(path.join(__dirname, '..', '__tests__', 'fixtures', 'sqlite'))
    process.chdir(
      path.join(
        __dirname,
        '..',
        '__tests__',
        'fixtures',
        'introspection',
        'postgresql',
      ),
    )
    const introspect = new Introspect()

    await introspect.parse(['--print'])
  } catch (err) {
    console.debug('YEs')
    console.debug({ err })

    handlePanic(err, packageJsonVersion, prismaVersion)
      .catch((e) => {
        console.error('Error: ' + e.stack)
        console.error('Error: ' + e.message)
      })
      .finally(() => {
        process.exit(1)
      })
  }
}

main()<commit_msg>test(cli): add manual test of introspection panic with sqlDump [skip ci]<commit_after>import { handlePanic } from '@prisma/migrate'
import path from 'path'
import fs from 'fs'
import { IntrospectionEngine } from '@prisma/sdk'

async function main() {
  const packageJsonVersion = '0.0.0'
  const prismaVersion = 'prismaVersionHash'

  try {
    const dirPath = path.join(
      __dirname,
      '..',
      '__tests__',
      'fixtures',
      'introspection',
      'postgresql',
    )

    process.chdir(dirPath)

    const schemaPath = path.join(dirPath, 'schema.prisma')
    const schema = fs.readFileSync(schemaPath, 'utf-8')

    const engine = new IntrospectionEngine({
      cwd: dirPath,
    })

    await engine.introspect(schema, false)
    await engine.debugPanic()
  } catch (err) {
    console.debug({ err })

    handlePanic(err, packageJsonVersion, prismaVersion)
      .catch((e) => {
        console.error('Error: ' + e.stack)
        console.error('Error: ' + e.message)
      })
      .finally(() => {
        process.exit(1)
      })
  }
}

main()
{'fraction_non_alphanumeric': 0.16088709677419355, 'fraction_numerical': 0.004838709677419355, 'mean_word_length': 2.5141643059490084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5317170', 'n_tokens_mistral': 866, 'n_tokens_neox': 842, 'n_words': 161}