File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ jest.mock("../src/middleware");
1212
1313describe ( "LESY:Loader" , ( ) => {
1414 describe . each ( [ "js" , "ts" ] ) ( "test %s" , ( flavor : string ) => {
15- let p ;
16- let d ;
15+ let p : Function ;
16+ let d : Function ;
1717 let loader : LesyLoader ;
1818 const addCmdRawObjSpy = jest . fn ( ) ;
1919 const featAddSpy = jest . fn ( ) ;
@@ -69,6 +69,11 @@ describe("LESY:Loader", () => {
6969 ) . toEqual ( 2 ) ;
7070 } ) ;
7171
72+ it ( "should exclude file with _ prefix" , ( ) => {
73+ expect ( loader [ "isAllowedFile" ] ( p `dummy.file` ) ) . toBeTruthy ( ) ;
74+ expect ( loader [ "isAllowedFile" ] ( p `_dummy.file` ) ) . toBeFalsy ( ) ;
75+ } ) ;
76+
7277 it ( "should exclude invalid files" , ( ) => {
7378 expect ( loader [ "isAllowedFile" ] ( p `dummy.file` ) ) . toBeTruthy ( ) ;
7479 const allowDefFile = flavor === "js" ;
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ class LesyCommand {
128128 }
129129
130130 private normalizeCmdNames ( cmd ) {
131+ if ( ! cmd . name ) cmd . name = "default" ;
131132 const names = [ cmd . name , ...cmd . aliases ] . map ( ( n : string ) =>
132133 this . normalizeStr ( n ) ,
133134 ) ;
Original file line number Diff line number Diff line change @@ -193,6 +193,7 @@ class LesyLoader {
193193 }
194194
195195 private isAllowedFile ( path : string ) {
196+ if ( path . startsWith ( "_" ) ) return false ;
196197 const ext = path . split ( "." ) ;
197198 const lastIndex = ext . length - 1 ;
198199 if ( process . env . LESY_LANG === "js" ) {
You can’t perform that action at this time.
0 commit comments