astro/packages/create-astro/test/helpers.js
Ben Holmes 7c49194ca2
Feat: [create astro] add directory prompt (#3168)
* wip: add prompt for directory with validation

* feat: wire up dir response to cwd

* feat: improve error handling on non-empty dirs

* fix: update test helpers to execaSync

* chore: add .skipped to old tests for clarity

* deps: add mocha and chai to create-astro

* feat: add directory step test with fixture

* feat: update turbo to run create-astro tests again 🥳

* chore: changeset
2022-04-21 16:36:48 -04:00

9 lines
493 B
JavaScript

import { execaSync } from 'execa';
import path from 'path';
import { fileURLToPath, pathToFileURL } from 'url';
const GITHUB_SHA = process.env.GITHUB_SHA || execaSync('git', ['rev-parse', 'HEAD']).stdout; // process.env.GITHUB_SHA will be set in CI; if testing locally execa() will gather this
const FIXTURES_DIR = path.join(fileURLToPath(path.dirname(import.meta.url)), 'fixtures');
const FIXTURES_URL = pathToFileURL(FIXTURES_DIR + '/');
export { GITHUB_SHA, FIXTURES_DIR, FIXTURES_URL };