@@ -501,6 +501,12 @@ function hasSkipTests(prBody: string, labels: string[]): boolean {
501501export function basicChecks ( input : DangerInputs , scopes : ScopeReport , parsedCommits : ParsedCommit [ ] ) : string [ ] {
502502 const warnings : string [ ] = [ ] ;
503503
504+ const commitTypes = new Set ( parsedCommits . map ( ( commit ) => commit . type ) . filter ( Boolean ) as string [ ] ) ;
505+ const refactorSignal =
506+ commitTypes . has ( "refactor" ) ||
507+ / r e f a c t o r / i. test ( input . prTitle || "" ) ||
508+ input . labels . some ( ( label ) => / r e f a c t o r / i. test ( label ) ) ;
509+
504510 const cleanedBody = ( input . prBody || "" ) . trim ( ) ;
505511 if ( cleanedBody . length < 40 ) {
506512 // === PR description completeness warnings ===
@@ -515,14 +521,17 @@ export function basicChecks(input: DangerInputs, scopes: ScopeReport, parsedComm
515521 }
516522
517523 const skipTests = hasSkipTests ( input . prBody || "" , input . labels ) ;
518- if ( ! skipTests && scopes . totals . source . files > 0 && scopes . totals . tests . files === 0 && scopes . totals [ "golden-tests" ] . files === 0 ) {
524+ if (
525+ ! skipTests &&
526+ ! refactorSignal &&
527+ scopes . totals . source . files > 0 &&
528+ scopes . totals . tests . files === 0 &&
529+ scopes . totals [ "golden-tests" ] . files === 0
530+ ) {
519531 // === Source changes without tests/fixtures warnings ===
520- warnings . push (
521- "Source changed but no tests or fixtures were updated. Add coverage or label with `no-tests-needed` / `[skip danger tests]` when appropriate." ,
522- ) ;
532+ warnings . push ( "Source changed but no tests or fixtures were updated." ) ;
523533 }
524534
525- const commitTypes = new Set ( parsedCommits . map ( ( commit ) => commit . type ) . filter ( Boolean ) as string [ ] ) ;
526535 const totalFiles = Object . values ( scopes . totals ) . reduce ( ( sum , scope ) => sum + scope . files , 0 ) ;
527536 const nonDocFiles = totalFiles - scopes . totals . docs . files ;
528537 const testFiles = scopes . totals . tests . files + scopes . totals [ "golden-tests" ] . files ;
0 commit comments