Skip to content

Commit e46e853

Browse files
bewestCopilot
andcommitted
docs: improve production safety check messaging
- Change 'FAILED' to 'ACTIVATED' - this is protective, not a failure - Explain that tests WILL DELETE data in the database - Explain the purpose: preventing accidental production data loss - List all override options clearly Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b1ffeee commit e46e853

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

tests/00_production-safety.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('00 Production Safety Check', function() {
4646
.catch(function(err) {
4747
// Fail the test suite immediately
4848
console.error('\n\n' + '!'.repeat(70));
49-
console.error('ABORTING TEST SUITE - PRODUCTION DATABASE DETECTED');
49+
console.error('TEST SUITE HALTED - Production safety check activated');
5050
console.error('!'.repeat(70) + '\n');
5151
process.exit(1);
5252
});

tests/lib/production-safety.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,26 @@ async function checkProductionSafety(ctx, env) {
126126
// Report errors and fail
127127
if (errors.length > 0) {
128128
console.error('\n' + '='.repeat(70));
129-
console.error('PRODUCTION SAFETY CHECK FAILED');
129+
console.error('🛡️ PRODUCTION SAFETY CHECK ACTIVATED');
130130
console.error('='.repeat(70));
131-
console.error('\nTests use deleteMany({}) which could DESTROY PRODUCTION DATA.\n');
131+
console.error('\nThis database appears to contain real data.');
132+
console.error('Running the test suite WILL DELETE all data in this database.');
133+
console.error('\nThis safety check exists to prevent accidental destruction of');
134+
console.error('production data. If this is truly a test database, you can override.\n');
132135

133136
errors.forEach((e, i) => {
134137
console.error(`${i + 1}. ${e.check}:`);
135138
console.error(` ${e.message}`);
136139
console.error(` 💡 ${e.hint}\n`);
137140
});
138141

139-
console.error('To bypass ALL checks (dangerous): TEST_SAFETY_SKIP=true');
142+
console.error('Override options:');
143+
console.error(' • Set TEST_SAFETY_MAX_ENTRIES to a higher value (e.g., 1000)');
144+
console.error(' • Set TEST_SAFETY_REQUIRE_TEST_DB=false to allow any DB name');
145+
console.error(' • Set TEST_SAFETY_SKIP=true to bypass ALL checks (dangerous!)');
140146
console.error('='.repeat(70) + '\n');
141147

142-
throw new Error('Production safety check failed: ' + errors.map(e => e.check).join(', '));
148+
throw new Error('Production safety check activated: ' + errors.map(e => e.check).join(', '));
143149
}
144150

145151
console.log('[SAFETY] ✅ All production safety checks passed');

0 commit comments

Comments
 (0)