1616import { join } from 'node:path' ;
1717import * as os from 'node:os' ;
1818import { expect } from 'chai' ;
19- import { createSandbox } from 'sinon' ;
19+ import Sinon , { createSandbox } from 'sinon' ;
2020import fs from 'graceful-fs' ;
2121import { Lifecycle } from '@salesforce/core' ;
22+ import { Logger } from '@salesforce/core/logger' ;
2223import { ForceIgnore } from '../../src/resolve/forceIgnore' ;
2324import * as fsUtil from '../../src/utils/fileSystemHandler' ;
2425
@@ -29,7 +30,10 @@ describe('ForceIgnore', () => {
2930 const testPath = join ( 'some' , 'path' , '__tests__' , 'myTest.x' ) ;
3031 const testPattern = '**/__tests__/**' ;
3132
32- afterEach ( ( ) => env . restore ( ) ) ;
33+ afterEach ( ( ) => {
34+ env . restore ( ) ;
35+ Sinon . restore ( ) ;
36+ } ) ;
3337
3438 it ( 'Should default to not ignoring a file if forceignore is not loaded' , ( ) => {
3539 const path = join ( 'some' , 'path' ) ;
@@ -40,9 +44,12 @@ describe('ForceIgnore', () => {
4044
4145 it ( 'Should ignore files with a given pattern' , ( ) => {
4246 env . stub ( fs , 'readFileSync' ) . returns ( testPattern ) ;
47+ const debugSpy = Sinon . spy ( Logger . prototype , 'debug' ) ;
4348 const forceIgnore = new ForceIgnore ( forceIgnorePath ) ;
4449 expect ( forceIgnore . accepts ( testPath ) ) . to . be . false ;
4550 expect ( forceIgnore . denies ( testPath ) ) . to . be . true ;
51+ expect ( debugSpy . calledOnce ) . to . be . true ;
52+ expect ( debugSpy . getCall ( 0 ) . args [ 0 ] ) . to . match ( / I g n o r i n g f i l e .+ b e c a u s e i t m a t c h e d .f o r c e i g n o r e p a t t e r n s ./ g) ;
4653 } ) ;
4754
4855 it ( 'windows separators no longer have any effect' , ( ) => {
0 commit comments