@@ -21,6 +21,7 @@ const defautResolvedPrompts = {
2121 apiBuildCommand : "npm run build:api" ,
2222 appDevserverCommand : "npm run dev" ,
2323 appDevserverUrl : "http://localhost:3000" ,
24+ apiDevserverUrl : "http://localhost:4040" ,
2425 confirmOverwrite : true ,
2526} ;
2627
@@ -154,4 +155,34 @@ describe("swa init", () => {
154155 }"
155156 ` ) ;
156157 } ) ;
158+
159+ it ( "should detect frameworks and let user override config options" , async ( ) => {
160+ mockFs ( { src : mockFs . load ( "e2e/fixtures/static-node-ts" ) } ) ;
161+ const promptsMock = jest . requireMock ( "prompts" ) ;
162+ promptsMock . mockResolvedValue ( {
163+ ...defautResolvedPrompts ,
164+ confirmSettings : false ,
165+ } ) ;
166+
167+ await init ( { ...defaultCliConfig , configName : "test" } ) ;
168+ const configFile = convertToUnixPaths ( fs . readFileSync ( defaultCliConfig . config , "utf-8" ) ) ;
169+
170+ expect ( configFile ) . toMatchInlineSnapshot ( `
171+ "{
172+ \\"$schema\\": \\"https://aka.ms/azure/static-web-apps-cli/schema\\",
173+ \\"configurations\\": {
174+ \\"test\\": {
175+ \\"appLocation\\": \\"./app\\",
176+ \\"apiLocation\\": \\"./api\\",
177+ \\"outputLocation\\": \\"./dist\\",
178+ \\"appBuildCommand\\": \\"npm run build\\",
179+ \\"apiBuildCommand\\": \\"npm run build:api\\",
180+ \\"run\\": \\"npm run dev\\",
181+ \\"appDevserverUrl\\": \\"http://localhost:3000\\",
182+ \\"apiDevserverUrl\\": \\"http://localhost:4040\\"
183+ }
184+ }
185+ }"
186+ ` ) ;
187+ } ) ;
157188} ) ;
0 commit comments