summaryrefslogtreecommitdiff
path: root/packages/create-astro/test/astro-add-step.test.js
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2022-04-29 11:45:43 -0400
committerGravatar GitHub <noreply@github.com> 2022-04-29 11:45:43 -0400
commitc8f5fa35c4c3cf08df45e6bd6cb78960782ae08b (patch)
tree44198a8ff767458e701de8089f5925d1f67f84ca /packages/create-astro/test/astro-add-step.test.js
parent6cd9ef577ecddcde655426c5f1bee34307eca8b8 (diff)
downloadastro-c8f5fa35c4c3cf08df45e6bd6cb78960782ae08b.tar.gz
astro-c8f5fa35c4c3cf08df45e6bd6cb78960782ae08b.tar.zst
astro-c8f5fa35c4c3cf08df45e6bd6cb78960782ae08b.zip
Feat: [create astro] git step (#3227)
* feat: add git init step * fix: update unit tests * feat: simplify next steps for copy pasteability * docs: add clarifying comment on test stdin spoofing * docs: remove "empty" from git repo message * fix: update git step text for test * fix: remove redundant --dryrun flag * refactor: simplify next steps with && * chore: changeset
Diffstat (limited to 'packages/create-astro/test/astro-add-step.test.js')
-rw-r--r--packages/create-astro/test/astro-add-step.test.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/create-astro/test/astro-add-step.test.js b/packages/create-astro/test/astro-add-step.test.js
index b46d836cc..73d963ed0 100644
--- a/packages/create-astro/test/astro-add-step.test.js
+++ b/packages/create-astro/test/astro-add-step.test.js
@@ -23,13 +23,14 @@ describe('[create-astro] astro add', function () {
});
it('should use "astro add" when user has installed dependencies', function () {
- const { stdout, stdin } = setup([tempDir, '--dryrun']);
+ const { stdout, stdin } = setup([tempDir]);
return promiseWithTimeout((resolve) => {
const seen = new Set();
const installPrompt = PROMPT_MESSAGES.install('npm');
stdout.on('data', (chunk) => {
if (!seen.has(PROMPT_MESSAGES.template) && chunk.includes(PROMPT_MESSAGES.template)) {
seen.add(PROMPT_MESSAGES.template);
+ // respond with "enter key"
stdin.write('\x0D');
}
if (!seen.has(installPrompt) && chunk.includes(installPrompt)) {
@@ -44,17 +45,19 @@ describe('[create-astro] astro add', function () {
});
it('should use "npx astro@latest add" when use has NOT installed dependencies', function () {
- const { stdout, stdin } = setup([tempDir, '--dryrun']);
+ const { stdout, stdin } = setup([tempDir]);
return promiseWithTimeout((resolve) => {
const seen = new Set();
const installPrompt = PROMPT_MESSAGES.install('npm');
stdout.on('data', (chunk) => {
if (!seen.has(PROMPT_MESSAGES.template) && chunk.includes(PROMPT_MESSAGES.template)) {
seen.add(PROMPT_MESSAGES.template);
+ // respond with "enter key"
stdin.write('\x0D');
}
if (!seen.has(installPrompt) && chunk.includes(installPrompt)) {
seen.add(installPrompt);
+ // respond with "no, then enter key"
stdin.write('n\x0D');
}
if (chunk.includes(PROMPT_MESSAGES.astroAdd('npx astro@latest add --yes'))) {