mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
- Adds `scripts/run-test-audit.sh` to automate unit test execution with coverage. - Adds `scripts/analyze-flakiness.mjs` to detect test flakiness. - Adds `scripts/static-test-analysis.mjs` to find suspicious test patterns. - Adds `scripts/coverage-gap-analysis.mjs` to identify critical coverage gaps. - Adds `scripts/generate-audit-report.mjs` to produce markdown reports. - Generates initial audit report `test-audit-report-2025-02-18.md` and `issues/ISSUE_test_audit_findings.md`. - Documents findings in `decisions/DECISIONS_2025-02-18.md`. Co-authored-by: PR0M3TH3AN <[email protected]>
45 lines
1.2 KiB
Bash
Executable File
45 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Setup
|
|
mkdir -p test-audit/coverage
|
|
|
|
echo "Step 1: Running unit tests with coverage..."
|
|
# We use || true because tests might fail, but we still want coverage
|
|
# Using npx c8 to ensure coverage is captured
|
|
npx c8 --reporter=lcov --reporter=text --reporter=json-summary npm run test:unit > test-audit/coverage-run.log 2>&1 || true
|
|
|
|
# Copy artifacts
|
|
# Check if coverage directory exists before copying
|
|
if [ -d "coverage" ]; then
|
|
cp -r coverage/* test-audit/coverage/
|
|
else
|
|
echo "Warning: coverage directory not found. Coverage step might have failed completely."
|
|
fi
|
|
|
|
echo "Step 2: Detecting flakiness..."
|
|
# Save the first run log
|
|
cp test-audit/coverage-run.log test-audit/run-1.log
|
|
|
|
# Run 2
|
|
echo "Pass 2..."
|
|
npm run test:unit > test-audit/run-2.log 2>&1 || true
|
|
|
|
# Run 3
|
|
echo "Pass 3..."
|
|
npm run test:unit > test-audit/run-3.log 2>&1 || true
|
|
|
|
echo "Step 3: Analyzing flakiness..."
|
|
node scripts/analyze-flakiness.mjs
|
|
|
|
echo "Step 4: Static Analysis..."
|
|
node scripts/static-test-analysis.mjs
|
|
|
|
echo "Step 5: Coverage Gap Analysis..."
|
|
node scripts/coverage-gap-analysis.mjs
|
|
|
|
echo "Step 6: Generating Report..."
|
|
node scripts/generate-audit-report.mjs
|
|
|
|
echo "Done. Report generated."
|