File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
packages/app/src/cli/models/app Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 11import {
2+ AppSchema ,
23 CurrentAppConfiguration ,
34 LegacyAppConfiguration ,
45 getAppScopes ,
@@ -92,6 +93,33 @@ describe('app schema validation', () => {
9293
9394 expect ( isCurrentAppSchema ( config ) ) . toBe ( false )
9495 } )
96+
97+ test ( 'extension_directories should be transformed to double asterisks' , ( ) => {
98+ const config = {
99+ ...CORRECT_CURRENT_APP_SCHEMA ,
100+ extension_directories : [ 'extensions/*' ] ,
101+ }
102+ const parsed = AppSchema . parse ( config )
103+ expect ( parsed . extension_directories ) . toEqual ( [ 'extensions/**' ] )
104+ } )
105+
106+ test ( 'extension_directories is not transformed if it ends with double asterisks' , ( ) => {
107+ const config = {
108+ ...CORRECT_CURRENT_APP_SCHEMA ,
109+ extension_directories : [ 'extensions/**' ] ,
110+ }
111+ const parsed = AppSchema . parse ( config )
112+ expect ( parsed . extension_directories ) . toEqual ( [ 'extensions/**' ] )
113+ } )
114+
115+ test ( 'extension_directories is not transformed if it doesnt end with a wildcard' , ( ) => {
116+ const config = {
117+ ...CORRECT_CURRENT_APP_SCHEMA ,
118+ extension_directories : [ 'extensions' ] ,
119+ }
120+ const parsed = AppSchema . parse ( config )
121+ expect ( parsed . extension_directories ) . toEqual ( [ 'extensions' ] )
122+ } )
95123 } )
96124} )
97125
Original file line number Diff line number Diff line change @@ -59,7 +59,8 @@ function removeTrailingPathSeparator(value: string[] | undefined) {
5959// If a path ends with a single asterisk, modify it to end with a double asterisk.
6060// This is to support the glob pattern used by chokidar and watch for changes in subfolders.
6161function fixSingleWildcards ( value : string [ ] | undefined ) {
62- return value ?. map ( ( dir ) => dir . replace ( / \* $ / , '**' ) )
62+ // eslint-disable-next-line no-useless-escape
63+ return value ?. map ( ( dir ) => dir . replace ( / ( [ ^ \* ] ) \* $ / , '$1**' ) )
6364}
6465
6566/**
You can’t perform that action at this time.
0 commit comments