mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Chore: remove complex install step test (#3756)
* chore: remove complex install step test * chore: changeset
This commit is contained in:
parent
cabd9dcc80
commit
507cd5c868
3 changed files with 5 additions and 71 deletions
5
.changeset/lemon-papayas-cough.md
Normal file
5
.changeset/lemon-papayas-cough.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'create-astro': patch
|
||||
---
|
||||
|
||||
Chore: remove create-astro install step test
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -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 = []) {
|
||||
|
|
Loading…
Reference in a new issue