2021-07-06 14:14:22 -05:00
|
|
|
import assert from 'assert';
|
2021-12-13 15:59:08 -05:00
|
|
|
import { execa } from 'execa';
|
2021-07-06 14:14:22 -05:00
|
|
|
import { FIXTURES_URL } from './helpers.js';
|
|
|
|
import { existsSync } from 'fs';
|
|
|
|
|
|
|
|
async function run(outdir, template) {
|
2021-12-22 16:11:05 -05:00
|
|
|
//--template cassidoo/shopify-react-astro
|
|
|
|
await execa('../../create-astro.mjs', [outdir, '--template', template, '--force-overwrite'], {
|
|
|
|
cwd: FIXTURES_URL.pathname,
|
|
|
|
});
|
2021-07-06 14:14:22 -05:00
|
|
|
}
|
|
|
|
|
2021-07-07 15:10:09 -05:00
|
|
|
const testCases = [['shopify', 'cassidoo/shopify-react-astro']];
|
2021-07-06 14:14:22 -05:00
|
|
|
|
|
|
|
async function tests() {
|
2021-12-22 16:11:05 -05:00
|
|
|
for (let [dir, tmpl] of testCases) {
|
|
|
|
await run(dir, tmpl);
|
2021-07-06 14:14:22 -05:00
|
|
|
|
2021-12-22 16:11:05 -05:00
|
|
|
const outPath = new URL('' + dir, FIXTURES_URL);
|
|
|
|
assert.ok(existsSync(outPath));
|
|
|
|
}
|
2021-07-06 14:14:22 -05:00
|
|
|
}
|
|
|
|
|
2021-07-07 15:10:09 -05:00
|
|
|
tests().catch((err) => {
|
2021-12-22 16:11:05 -05:00
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
2021-07-07 15:10:09 -05:00
|
|
|
});
|