Skip to content

Commit d3db2b2

Browse files
committed
Testing, formatting
1 parent ba502fc commit d3db2b2

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

Diff for: packages/cli/src/commands/hydrogen/init.test.ts

+46-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ describe('init', () => {
196196
expect(output).not.toMatch('warning');
197197
expect(output).not.toMatch('Routes');
198198
expect(output).toMatch(/Language:\s*TypeScript/);
199-
expect(output).toMatch('Help');
200199
expect(output).toMatch('Next steps');
201200
expect(output).toMatch(
202201
// Output contains banner characters. USe [^\w]*? to match them.
@@ -368,7 +367,6 @@ describe('init', () => {
368367
expect(output).toMatch(basename(tmpDir));
369368
expect(output).not.toMatch('Routes');
370369
expect(output).toMatch(/Language:\s*TypeScript/);
371-
expect(output).toMatch('Help');
372370
expect(output).toMatch('Next steps');
373371
expect(output).toMatch(
374372
// Output contains banner characters. USe [^\w]*? to match them.
@@ -824,5 +822,51 @@ describe('init', () => {
824822
});
825823
});
826824
});
825+
826+
describe('Quickstart options', () => {
827+
it('Scaffolds Quickstart project with expected values', async () => {
828+
await inTemporaryDirectory(async (tmpDir) => {
829+
await runInit({
830+
path: tmpDir,
831+
quickstart: true,
832+
installDeps: false,
833+
});
834+
835+
const templateFiles = await glob('**/*', {
836+
cwd: getSkeletonSourceDir().replace(
837+
'skeleton',
838+
'hydrogen-quickstart',
839+
),
840+
ignore: ['**/node_modules/**', '**/dist/**'],
841+
});
842+
const resultFiles = await glob('**/*', {cwd: tmpDir});
843+
const nonAppFiles = templateFiles.filter(
844+
(item) => !item.startsWith('app/'),
845+
);
846+
847+
expect(resultFiles).toEqual(expect.arrayContaining(nonAppFiles));
848+
849+
expect(resultFiles).toContain('app/root.jsx');
850+
expect(resultFiles).toContain('app/entry.client.jsx');
851+
expect(resultFiles).toContain('app/entry.server.jsx');
852+
expect(resultFiles).toContain('app/components/Layout.jsx');
853+
expect(resultFiles).toContain('app/routes/_index.jsx');
854+
expect(resultFiles).not.toContain('app/routes/($locale)._index.jsx');
855+
856+
// await expect(readFile(`${tmpDir}/package.json`)).resolves.toMatch(
857+
// `"name": "hello-world"`,
858+
// );
859+
860+
const output = outputMock.info();
861+
expect(output).not.toMatch('warning');
862+
expect(output).toMatch('success');
863+
expect(output).toMatch(/Shopify:\s+Mock.shop/);
864+
expect(output).toMatch(/Language:\s+JavaScript/);
865+
expect(output).toMatch(/Styling:\s+Tailwind/);
866+
expect(output).toMatch('Routes');
867+
expect(output).toMatch('Next steps');
868+
});
869+
});
870+
});
827871
});
828872
});

Diff for: packages/cli/src/lib/onboarding/common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ export async function renderProjectReady(
630630
const nextSteps = [];
631631

632632
if (true) {
633-
nextSteps.push(['Dependencies', 'were installed'])
633+
nextSteps.push(['Dependencies', 'were installed']);
634634
}
635635

636636
render({

Diff for: packages/cli/src/lib/onboarding/local.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ export async function setupLocalStarterTemplate(
111111
// Note: Async task titles automatically have '...' appended
112112
const initMsg = {
113113
create: 'Creating storefront',
114-
setup: `Setting up ${options.quickstart ? 'Quickstart ': ''}project`,
114+
setup: `Setting up ${options.quickstart ? 'Quickstart ' : ''}project`,
115115
install: 'Installing dependencies. This could take a few minutes',
116-
}
116+
};
117117

118118
const tasks = [
119119
{
@@ -281,7 +281,7 @@ export async function setupLocalStarterTemplate(
281281

282282
// If running in --quickstart mode, skip this success banner
283283
if (options.quickstart) {
284-
console.log("\n");
284+
console.log('\n');
285285
} else {
286286
renderSuccess({
287287
headline: [

0 commit comments

Comments
 (0)