Skip to content

Commit

Permalink
Fix acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kemmerle committed Dec 19, 2024
1 parent 584706b commit 77bebbd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
27 changes: 18 additions & 9 deletions acceptance-tests/tests/commands/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
Expand All @@ -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]
);
Expand All @@ -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]
);
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/workflows/cmsTemplateFlow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
Expand Down
7 changes: 6 additions & 1 deletion commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -117,6 +121,7 @@ exports.builder = yargs => {
hidden: true,
});

addConfigOptions(yargs);
addGlobalOptions(yargs);

return yargs;
Expand Down

0 comments on commit 77bebbd

Please sign in to comment.