import { tap } from '@push.rocks/tapbundle';
import * as fs from 'fs/promises';
import * as path from 'path';

// Master test for corpus testing
tap.test('Run all corpus tests', async () => {
  console.log('Running all corpus tests...');

  // Create output directory
  const testDir = path.join(process.cwd(), 'test', 'output');
  await fs.mkdir(testDir, { recursive: true });

  // Generate a summary report from existing results
  try {
    // Create a simple summary
    const summary = `# XInvoice Corpus Testing Summary

Generated on: ${new Date().toISOString()}

## Note

This is a placeholder summary. The actual tests are run individually.
`;

    // Write the summary to a file
    await fs.writeFile(
      path.join(testDir, 'corpus-summary.md'),
      summary
    );

    console.log('Corpus summary generated.');
  } catch (error) {
    console.error('Error generating corpus summary:', error);
  }
});



// Run the tests
tap.start();
