diff options
Diffstat (limited to 'packages/create-astro/test/create-astro.test.js')
-rw-r--r-- | packages/create-astro/test/create-astro.test.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/create-astro/test/create-astro.test.js b/packages/create-astro/test/create-astro.test.js index d7abb7e64..aa9323012 100644 --- a/packages/create-astro/test/create-astro.test.js +++ b/packages/create-astro/test/create-astro.test.js @@ -8,24 +8,24 @@ import * as assert from 'uvu/assert'; const CreateAstro = suite('npm init astro'); -const cwd = fileURLToPath(new URL('./fixtures/', import.meta.url)); - -const templates = ['blank', 'starter']; +const cwd = fileURLToPath(path.dirname(import.meta.url)); +const templates = fs.readdirSync(path.join(cwd, '..', 'src', 'templates')); CreateAstro.before(async () => { - await del(cwd); - await fs.promises.mkdir(cwd); + const fixturesDir = path.join(cwd, 'fixtures'); + await del(fixturesDir); + await fs.promises.mkdir(fixturesDir); }); for (const template of templates) { CreateAstro(template, async () => { - const { stdout } = await execa('../../create-astro.js', [`./${template}`, '--template', template, '--skip-install'], { cwd }); + const { stdout } = await execa('../../create-astro.js', [`./${template}`, '--template', template, '--skip-install'], { cwd: path.join(cwd, 'fixtures') }); // test: path should formatted as './{dirName}' assert.not.match(stdout, '././'); const DOES_HAVE = ['.gitignore', 'package.json', 'public', 'src']; - const DOES_NOT_HAVE = ['_gitignore', 'meta.json', 'node_modules']; + const DOES_NOT_HAVE = ['_gitignore', 'meta.json', 'node_modules', 'yarn.lock']; // test: template contains essential files & folders for (const file of DOES_HAVE) { |