From 4f307f79846f1a46c1136ee0beb78b036ca6a4d5 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 18 May 2022 10:28:26 -0500 Subject: [PATCH] test: add i18n regression test --- packages/astro/test/cli.test.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/astro/test/cli.test.js b/packages/astro/test/cli.test.js index 98e0ade0a6be..480a530d0c37 100644 --- a/packages/astro/test/cli.test.js +++ b/packages/astro/test/cli.test.js @@ -25,18 +25,6 @@ describe('astro cli', () => { expect(proc.stdout).to.include(pkgVersion); }); - const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); - const LOCALES = ['en_US', 'sv_SE', 'es_419.UTF-8', 'es_ES@euro', 'C']; - LOCALES.forEach((locale) => { - it(`astro does NOT throw on "${locale}" locales`, async () => { - const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url); - const proc = cli('dev', '--root', fileURLToPath(projectRootURL), { extendEnv: false, env: { LANG: locale }}); - - await Promise.race([proc, sleep(5000).then(() => proc.kill(0))]); - expect(proc.exitCode).to.equal(0, ``); - }); - }) - it('astro build', async () => { const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url); const proc = await cli('build', '--root', fileURLToPath(projectRootURL)); @@ -122,3 +110,21 @@ describe('astro cli', () => { }); }); }); + +describe('astro cli i18n', () => { + const LOCALES = ['en_US', 'sv_SE', 'es_419.UTF-8', 'es_ES@euro', 'C']; + LOCALES.forEach((locale) => { + it(`astro does NOT throw on "${locale}" locales`, async () => { + const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url); + let error = null; + try { + const proc = cli('dev', '--root', fileURLToPath(projectRootURL), { env: { LANG: locale }}); + await parseCliDevStart(proc) + } catch (e) { + console.log(e); + error = e.message; + } + expect(error).to.be.null; + }); + }) +})