diff --git a/packages/create-sitecore-jss/src/init-runner.test.ts b/packages/create-sitecore-jss/src/init-runner.test.ts index 41d5feaa47..ae53a28cde 100644 --- a/packages/create-sitecore-jss/src/init-runner.test.ts +++ b/packages/create-sitecore-jss/src/init-runner.test.ts @@ -168,6 +168,33 @@ describe('initRunner', () => { ); }); + it('should aggregate nextSteps when using non base, post-initializer template', async () => { + const templates = ['bar']; + const appName = 'test-app-bar'; + const args = { + silent: false, + destination: 'samples/next', + templates, + }; + + const mockBar = mockInitializer(false, { + appName, + nextSteps: ['bar step 1', 'bar step 2'], + initializers: ['baz'], + }); + const mockBaz = mockInitializer(false, { appName, nextSteps: ['baz step 1'] }); + createStub = sinon.stub(InitializerFactory.prototype, 'create'); + createStub.withArgs('bar').returns(mockBar); + createStub.withArgs('baz').returns(mockBaz); + + await initRunner(templates, args); + + expect(nextStepsStub).to.be.calledOnceWith( + [appName], + ['bar step 1', 'bar step 2', 'baz step 1'] + ); + }); + it('should pass two appNames when two main apps initialized', async () => { const templates = ['foo', 'bar']; const args = { diff --git a/packages/create-sitecore-jss/src/init-runner.ts b/packages/create-sitecore-jss/src/init-runner.ts index a9ca33a644..db636d94b2 100644 --- a/packages/create-sitecore-jss/src/init-runner.ts +++ b/packages/create-sitecore-jss/src/init-runner.ts @@ -27,9 +27,7 @@ export const initRunner = async (initializers: string[], args: BaseArgs) => { const response = await initializer.init(args); // We can have multiple appNames if base template requires to setup an additional standalone app (e.g. XM Cloud proxy) - if (initializer.isBase) { - appNames.add(response.appName); - } + appNames.add(response.appName); nextStepsArr = [...nextStepsArr, ...(response.nextSteps ?? [])]; // process any returned initializers if (response.initializers && response.initializers.length > 0) {