From 507cd5c868448971c6265d97f22e786263dd5a77 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Tue, 28 Jun 2022 13:46:54 -0400 Subject: [PATCH] Chore: remove complex install step test (#3756) * chore: remove complex install step test * chore: changeset --- .changeset/lemon-papayas-cough.md | 5 ++ .../create-astro/test/install-step.test.js | 69 ------------------- packages/create-astro/test/utils.js | 2 - 3 files changed, 5 insertions(+), 71 deletions(-) create mode 100644 .changeset/lemon-papayas-cough.md delete mode 100644 packages/create-astro/test/install-step.test.js diff --git a/.changeset/lemon-papayas-cough.md b/.changeset/lemon-papayas-cough.md new file mode 100644 index 000000000000..19ed2ad34530 --- /dev/null +++ b/.changeset/lemon-papayas-cough.md @@ -0,0 +1,5 @@ +--- +'create-astro': patch +--- + +Chore: remove create-astro install step test diff --git a/packages/create-astro/test/install-step.test.js b/packages/create-astro/test/install-step.test.js deleted file mode 100644 index 78d014257c6a..000000000000 --- a/packages/create-astro/test/install-step.test.js +++ /dev/null @@ -1,69 +0,0 @@ -import { setup, promiseWithTimeout, timeout, PROMPT_MESSAGES } from './utils.js'; -import { sep } from 'path'; -import fs from 'fs'; -import os from 'os'; - -const FAKE_PACKAGE_MANAGER = 'banana'; -let initialEnvValue = null; - -// TODO: enable test, it was consistently timing out in CI -describe.skip('[create-astro] install', function () { - this.timeout(timeout); - let tempDir = ''; - beforeEach(async () => { - tempDir = await fs.promises.mkdtemp(`${os.tmpdir()}${sep}`); - }); - this.beforeAll(() => { - initialEnvValue = process.env.npm_config_user_agent; - process.env.npm_config_user_agent = FAKE_PACKAGE_MANAGER; - }); - this.afterAll(() => { - process.env.npm_config_user_agent = initialEnvValue; - }); - - it('should respect package manager in prompt', function () { - const { stdout, stdin } = setup([tempDir]); - return promiseWithTimeout((resolve) => { - const seen = new Set(); - const installPrompt = PROMPT_MESSAGES.install(FAKE_PACKAGE_MANAGER); - 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); - resolve(); - } - }); - }); - }); - - it('should respect package manager in next steps', function () { - const { stdout, stdin } = setup([tempDir]); - return promiseWithTimeout((resolve) => { - const seen = new Set(); - const installPrompt = PROMPT_MESSAGES.install(FAKE_PACKAGE_MANAGER); - 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 (!seen.has(PROMPT_MESSAGES.git) && chunk.includes(PROMPT_MESSAGES.git)) { - seen.add(PROMPT_MESSAGES.git); - stdin.write('\x0D'); - } - if (chunk.includes('banana dev')) { - resolve(); - } - }); - }); - }); -}); diff --git a/packages/create-astro/test/utils.js b/packages/create-astro/test/utils.js index 9d227f6b5bc2..b085ef0833b4 100644 --- a/packages/create-astro/test/utils.js +++ b/packages/create-astro/test/utils.js @@ -26,8 +26,6 @@ export function promiseWithTimeout(testFn) { export const PROMPT_MESSAGES = { directory: 'Where would you like to create your new project?', template: 'Which template would you like to use?', - install: (pkgManager) => `Would you like us to run "${pkgManager} install?"`, - git: 'Initialize a new git repository?', }; export function setup(args = []) {