diff --git a/acceptance-tests/tests/commands/create.spec.ts b/acceptance-tests/tests/commands/create.spec.ts index 7770efe31..97717f628 100644 --- a/acceptance-tests/tests/commands/create.spec.ts +++ b/acceptance-tests/tests/commands/create.spec.ts @@ -69,7 +69,7 @@ describe('hs create', () => { }); it('creates a module', async () => { - await testState.cli.execute( + await testState.cli.executeWithTestConfig( ['create', 'module', FOLDERS.module.name], ['label', ENTER, ENTER, ENTER, 'y', ENTER, ENTER] ); @@ -80,7 +80,7 @@ describe('hs create', () => { }); it('creates a template', async () => { - await testState.cli.execute( + await testState.cli.executeWithTestConfig( ['create', 'template', FOLDERS.template.name], [ENTER] ); @@ -90,35 +90,44 @@ describe('hs create', () => { }); it('website-theme', async () => { - await testState.cli.execute(['create', FOLDERS.websiteTheme.name]); + await testState.cli.executeWithTestConfig([ + 'create', + FOLDERS.websiteTheme.name, + ]); expect( testState.existsInTestOutputDirectory(FOLDERS.websiteTheme.folder) ).toBe(true); }); it('react-app', async () => { - await testState.cli.execute(['create', FOLDERS.reactApp.name]); + await testState.cli.executeWithTestConfig([ + 'create', + FOLDERS.reactApp.name, + ]); expect(testState.existsInTestOutputDirectory(FOLDERS.reactApp.folder)).toBe( true ); }); it('vue-app', async () => { - await testState.cli.execute(['create', FOLDERS.vueApp.name]); + await testState.cli.executeWithTestConfig(['create', FOLDERS.vueApp.name]); expect(testState.existsInTestOutputDirectory(FOLDERS.vueApp.folder)).toBe( true ); }); it('webpack-serverless', async () => { - await testState.cli.execute(['create', FOLDERS.webpackServerless.name]); + await testState.cli.executeWithTestConfig([ + 'create', + FOLDERS.webpackServerless.name, + ]); expect( testState.existsInTestOutputDirectory(FOLDERS.webpackServerless.folder) ).toBe(true); }); it('api-sample', async () => { - await testState.cli.execute( + await testState.cli.executeWithTestConfig( ['create', FOLDERS.apiSample.name, FOLDERS.apiSample.name], [ENTER, ENTER] ); @@ -129,14 +138,14 @@ describe('hs create', () => { }); it('app', async () => { - await testState.cli.execute(['create', FOLDERS.app.name]); + await testState.cli.executeWithTestConfig(['create', FOLDERS.app.name]); expect(testState.existsInTestOutputDirectory(FOLDERS.app.folder)).toBe( true ); }); it('function', async () => { - await testState.cli.execute( + await testState.cli.executeWithTestConfig( ['create', 'function'], [ FOLDERS.function.name, diff --git a/acceptance-tests/tests/workflows/cmsTemplateFlow.spec.ts b/acceptance-tests/tests/workflows/cmsTemplateFlow.spec.ts index 2030e081f..680b11234 100644 --- a/acceptance-tests/tests/workflows/cmsTemplateFlow.spec.ts +++ b/acceptance-tests/tests/workflows/cmsTemplateFlow.spec.ts @@ -21,7 +21,7 @@ describe('CMS Template Flow', () => { describe('hs create', () => { it('should create a CMS template', async () => { - await testState.cli.execute( + await testState.cli.executeWithTestConfig( ['create', 'template', TEMPLATE_NAME], [ENTER] ); diff --git a/commands/create.ts b/commands/create.ts index ef180cb75..5dd1ef57f 100644 --- a/commands/create.ts +++ b/commands/create.ts @@ -26,7 +26,11 @@ const fs = require('fs-extra'); const { logError } = require('../lib/errorHandlers/index'); const { logger } = require('@hubspot/local-dev-lib/logger'); -const { setLogLevel, addGlobalOptions } = require('../lib/commonOpts'); +const { + setLogLevel, + addGlobalOptions, + addConfigOptions, +} = require('../lib/commonOpts'); const { resolveLocalPath } = require('../lib/filesystem'); const { trackCommandUsage } = require('../lib/usageTracking'); const assets = require('./create/index'); @@ -117,6 +121,7 @@ exports.builder = yargs => { hidden: true, }); + addConfigOptions(yargs); addGlobalOptions(yargs); return yargs;