@@ -6,12 +6,10 @@ import {
66 getPackageManagerInfo ,
77} from '../package-manager' ;
88
9- // Mock fs module
109vi . mock ( 'fs' , ( ) => ( {
1110 existsSync : vi . fn ( ) ,
1211} ) ) ;
1312
14- // Mock path module
1513vi . mock ( 'path' , ( ) => ( {
1614 join : vi . fn ( ) ,
1715} ) ) ;
@@ -26,12 +24,12 @@ describe('package-manager', () => {
2624 const mockExistsSync = vi . mocked ( existsSync ) ;
2725 const mockJoin = vi . mocked ( join ) ;
2826
29- mockJoin . mockImplementation ( ( dir : string , file : string ) => {
30- return `${ dir } /${ file } ` ;
31- } ) ;
32- mockExistsSync . mockImplementation ( ( path : any ) => {
33- return path === '/test/package-lock.json' ;
34- } ) ;
27+ mockJoin . mockImplementation (
28+ ( dir : string , file : string ) => `${ dir } /${ file } `
29+ ) ;
30+ mockExistsSync . mockImplementation (
31+ path => path === '/test/package-lock.json'
32+ ) ;
3533
3634 const result = detectPackageManager ( '/test' ) ;
3735
@@ -46,12 +44,12 @@ describe('package-manager', () => {
4644 const mockExistsSync = vi . mocked ( existsSync ) ;
4745 const mockJoin = vi . mocked ( join ) ;
4846
49- mockJoin . mockImplementation ( ( dir : string , file : string ) => {
50- return `${ dir } /${ file } ` ;
51- } ) ;
52- mockExistsSync . mockImplementation ( ( path : any ) => {
53- return path === '/test/pnpm-lock.yaml' ;
54- } ) ;
47+ mockJoin . mockImplementation (
48+ ( dir : string , file : string ) => `${ dir } /${ file } `
49+ ) ;
50+ mockExistsSync . mockImplementation (
51+ path => path === '/test/pnpm-lock.yaml'
52+ ) ;
5553
5654 const result = detectPackageManager ( '/test' ) ;
5755
@@ -66,12 +64,10 @@ describe('package-manager', () => {
6664 const mockExistsSync = vi . mocked ( existsSync ) ;
6765 const mockJoin = vi . mocked ( join ) ;
6866
69- mockJoin . mockImplementation ( ( dir : string , file : string ) => {
70- return `${ dir } /${ file } ` ;
71- } ) ;
72- mockExistsSync . mockImplementation ( ( path : any ) => {
73- return path === '/test/yarn.lock' ;
74- } ) ;
67+ mockJoin . mockImplementation (
68+ ( dir : string , file : string ) => `${ dir } /${ file } `
69+ ) ;
70+ mockExistsSync . mockImplementation ( path => path === '/test/yarn.lock' ) ;
7571
7672 const result = detectPackageManager ( '/test' ) ;
7773
@@ -86,12 +82,10 @@ describe('package-manager', () => {
8682 const mockExistsSync = vi . mocked ( existsSync ) ;
8783 const mockJoin = vi . mocked ( join ) ;
8884
89- mockJoin . mockImplementation ( ( dir : string , file : string ) => {
90- return `${ dir } /${ file } ` ;
91- } ) ;
92- mockExistsSync . mockImplementation ( ( path : any ) => {
93- return path === '/test/bun.lockb' ;
94- } ) ;
85+ mockJoin . mockImplementation (
86+ ( dir : string , file : string ) => `${ dir } /${ file } `
87+ ) ;
88+ mockExistsSync . mockImplementation ( path => path === '/test/bun.lockb' ) ;
9589
9690 const result = detectPackageManager ( '/test' ) ;
9791
0 commit comments