File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -84,15 +84,13 @@ function getProjectRootDirectoryFromNodeModules(projectPath) {
8484 const projDir = projectPath . split ( / [ \\ / ] / ) // <- would split both on '/' and '\'
8585
8686 if ( projDir . includes ( '.pnpm' )
87- && projDir . length > 5
88- && _arraysAreEqual ( projDir . slice ( projDir . length - 5 ) , [
87+ && projDir . length > 3
88+ && _arraysAreEqual ( projDir . slice ( projDir . length - 3 ) , [
8989 'node_modules' ,
9090 '.pnpm' ,
9191 `simple-git-hooks@${ packageVersion } ` ,
92- 'node_modules' ,
93- 'simple-git-hooks'
9492 ] ) ) {
95- return projDir . slice ( 0 , projDir . length - 5 ) . join ( '/' ) ;
93+ return projDir . slice ( 0 , projDir . length - 3 ) . join ( '/' ) ;
9694 }
9795
9896 // A yarn2 STAB
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ test('getProjectRootDirectory falls back to undefined when we are not in node_mo
2121} )
2222
2323test ( 'getProjectRootDirectory return correct dir when installed using pnpm:' , ( ) => {
24- expect ( spc . getProjectRootDirectoryFromNodeModules ( `var/my-project/node_modules/.pnpm/simple-git-hooks@${ packageVersion } /node_modules/simple-git-hooks ` ) ) . toBe ( 'var/my-project' )
24+ expect ( spc . getProjectRootDirectoryFromNodeModules ( `var/my-project/node_modules/.pnpm/simple-git-hooks@${ packageVersion } ` ) ) . toBe ( 'var/my-project' )
2525} )
2626
2727
You can’t perform that action at this time.
0 commit comments