diff --git a/packages/astro/test/0-css.test.js b/packages/astro/test/0-css.test.js index eec091c24..70dd11a5e 100644 --- a/packages/astro/test/0-css.test.js +++ b/packages/astro/test/0-css.test.js @@ -269,7 +269,7 @@ describe('CSS', function () { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('resolves CSS in public/', async () => { diff --git a/packages/astro/test/astro-basic.test.js b/packages/astro/test/astro-basic.test.js index eab0a077e..4b76b7d40 100644 --- a/packages/astro/test/astro-basic.test.js +++ b/packages/astro/test/astro-basic.test.js @@ -16,7 +16,7 @@ describe('Astro basics', () => { // important: close preview server (free up port and connection) after(async () => { - if (previewServer) await previewServer.stop(); + await previewServer.stop(); }); describe('build', () => { diff --git a/packages/astro/test/astro-get-static-paths.test.js b/packages/astro/test/astro-get-static-paths.test.js index cc46dfcd5..cecfebe70 100644 --- a/packages/astro/test/astro-get-static-paths.test.js +++ b/packages/astro/test/astro-get-static-paths.test.js @@ -28,7 +28,7 @@ describe('getStaticPaths - 404 behavior', () => { }); after(async () => { - devServer && devServer.stop(); + devServer.stop(); }); it('resolves 200 on matching static path - named params', async () => { diff --git a/packages/astro/test/astro-partial-html.test.js b/packages/astro/test/astro-partial-html.test.js index 0704f5a0a..a36981b7b 100644 --- a/packages/astro/test/astro-partial-html.test.js +++ b/packages/astro/test/astro-partial-html.test.js @@ -14,7 +14,7 @@ describe('Partial HTML ', async () => { }); after(async () => { - devServer && devServer.stop(); + await devServer.stop(); }); it('injects Astro styles and scripts', async () => { diff --git a/packages/astro/test/astro-sitemap-rss.test.js b/packages/astro/test/astro-sitemap-rss.test.js index 493c603bd..38b788efb 100644 --- a/packages/astro/test/astro-sitemap-rss.test.js +++ b/packages/astro/test/astro-sitemap-rss.test.js @@ -15,8 +15,6 @@ describe('Sitemaps', () => { await fixture.build(); }); - after(() => fixture.clean()); - describe('RSS Generation', () => { it('generates RSS correctly', async () => { const rss = await fixture.readFile('/custom/feed.xml'); @@ -58,8 +56,6 @@ describe('Sitemaps served from subdirectory', () => { await fixture.build(); }); - after(() => fixture.clean()); - describe('Sitemap Generation', () => { it('Generates Sitemap correctly', async () => { let sitemap = await fixture.readFile('/sitemap.xml'); diff --git a/packages/astro/test/cli.test.js b/packages/astro/test/cli.test.js index 793418d50..3fd9a6984 100644 --- a/packages/astro/test/cli.test.js +++ b/packages/astro/test/cli.test.js @@ -25,6 +25,12 @@ describe('astro cli', () => { expect(proc.stdout).to.include(pkgVersion); }); + it('astro build', async () => { + const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url); + const proc = await cli('build', '--project-root', fileURLToPath(projectRootURL)); + expect(proc.stdout).to.include('Done'); + }); + it('astro dev welcome', async () => { const pkgURL = new URL('../package.json', import.meta.url); const pkgVersion = await fs.readFile(pkgURL, 'utf8').then((data) => JSON.parse(data).version); @@ -93,11 +99,4 @@ describe('astro cli', () => { }); }); - it('astro build', async () => { - const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url); - - const proc = await cli('build', '--project-root', fileURLToPath(projectRootURL)); - - expect(proc.stdout).to.include('Done'); - }); }); diff --git a/packages/astro/test/debug-component.test.js b/packages/astro/test/debug-component.test.js index b590e25bd..02b560658 100644 --- a/packages/astro/test/debug-component.test.js +++ b/packages/astro/test/debug-component.test.js @@ -19,7 +19,7 @@ describe('', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('Works in markdown pages', async () => { diff --git a/packages/astro/test/dev-routing.test.js b/packages/astro/test/dev-routing.test.js index 9e1721c2f..42466ffa6 100644 --- a/packages/astro/test/dev-routing.test.js +++ b/packages/astro/test/dev-routing.test.js @@ -15,7 +15,7 @@ describe('Development Routing', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('200 when loading /', async () => { @@ -56,7 +56,7 @@ describe('Development Routing', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('200 when loading /', async () => { @@ -92,7 +92,7 @@ describe('Development Routing', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('404 when loading /', async () => { @@ -138,7 +138,7 @@ describe('Development Routing', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('404 when loading /', async () => { @@ -184,7 +184,7 @@ describe('Development Routing', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('200 when loading /home.json', async () => { diff --git a/packages/astro/test/fixtures/with-subpath-no-trailing-slash/.gitignore b/packages/astro/test/fixtures/with-subpath-no-trailing-slash/.gitignore new file mode 100644 index 000000000..8a085be49 --- /dev/null +++ b/packages/astro/test/fixtures/with-subpath-no-trailing-slash/.gitignore @@ -0,0 +1 @@ +/dist-* diff --git a/packages/astro/test/preview-routing.test.js b/packages/astro/test/preview-routing.test.js index 5eeea843e..95d48b7e6 100644 --- a/packages/astro/test/preview-routing.test.js +++ b/packages/astro/test/preview-routing.test.js @@ -12,6 +12,7 @@ describe('Preview Routing', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/with-subpath-no-trailing-slash/', + dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4000/', import.meta.url), buildOptions: { pageUrlFormat: 'directory', }, @@ -25,7 +26,7 @@ describe('Preview Routing', () => { }); after(async () => { - previewServer && (await previewServer.stop()); + (await previewServer.stop()); }); it('404 when loading /', async () => { @@ -69,6 +70,7 @@ describe('Preview Routing', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/with-subpath-no-trailing-slash/', + dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4001/', import.meta.url), devOptions: { trailingSlash: 'always', port: 4001, @@ -79,7 +81,7 @@ describe('Preview Routing', () => { }); after(async () => { - previewServer && (await previewServer.stop()); + (await previewServer.stop()); }); it('404 when loading /', async () => { @@ -127,6 +129,7 @@ describe('Preview Routing', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/with-subpath-no-trailing-slash/', + dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4002//', import.meta.url), devOptions: { trailingSlash: 'ignore', port: 4002, @@ -137,7 +140,7 @@ describe('Preview Routing', () => { }); after(async () => { - previewServer && (await previewServer.stop()); + (await previewServer.stop()); }); it('404 when loading /', async () => { @@ -187,6 +190,7 @@ describe('Preview Routing', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/with-subpath-no-trailing-slash/', + dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4003/', import.meta.url), buildOptions: { pageUrlFormat: 'file', }, @@ -200,7 +204,7 @@ describe('Preview Routing', () => { }); after(async () => { - previewServer && (await previewServer.stop()); + (await previewServer.stop()); }); it('404 when loading /', async () => { @@ -244,6 +248,7 @@ describe('Preview Routing', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/with-subpath-no-trailing-slash/', + dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4004/', import.meta.url), buildOptions: { pageUrlFormat: 'file', }, @@ -257,7 +262,7 @@ describe('Preview Routing', () => { }); after(async () => { - previewServer && (await previewServer.stop()); + (await previewServer.stop()); }); it('404 when loading /', async () => { @@ -305,6 +310,7 @@ describe('Preview Routing', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/with-subpath-no-trailing-slash/', + dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4005/', import.meta.url), buildOptions: { pageUrlFormat: 'file', }, @@ -318,7 +324,7 @@ describe('Preview Routing', () => { }); after(async () => { - previewServer && (await previewServer.stop()); + (await previewServer.stop()); }); it('404 when loading /', async () => { @@ -366,6 +372,7 @@ describe('Preview Routing', () => { before(async () => { fixture = await loadFixture({ projectRoot: './fixtures/with-subpath-no-trailing-slash/', + dist: new URL('./fixtures/with-subpath-no-trailing-slash/dist-4006/', import.meta.url), buildOptions: { pageUrlFormat: 'file', }, @@ -379,7 +386,7 @@ describe('Preview Routing', () => { }); after(async () => { - previewServer && (await previewServer.stop()); + (await previewServer.stop()); }); it('404 when loading /', async () => { diff --git a/packages/astro/test/react-component.test.js b/packages/astro/test/react-component.test.js index fcfab827e..871cafdfd 100644 --- a/packages/astro/test/react-component.test.js +++ b/packages/astro/test/react-component.test.js @@ -85,7 +85,7 @@ describe('React Components', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('scripts proxy correctly', async () => { diff --git a/packages/astro/test/sass.test.js b/packages/astro/test/sass.test.js index 02ad938e5..1a5b198c8 100644 --- a/packages/astro/test/sass.test.js +++ b/packages/astro/test/sass.test.js @@ -14,7 +14,7 @@ describe('Sass', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); // TODO: Sass cannot be found on macOS for some reason... Vite issue? diff --git a/packages/astro/test/solid-component.test.js b/packages/astro/test/solid-component.test.js index 8b76e9f6f..2e9f82469 100644 --- a/packages/astro/test/solid-component.test.js +++ b/packages/astro/test/solid-component.test.js @@ -39,7 +39,7 @@ describe('Solid component', () => { }); after(async () => { - devServer & devServer.stop(); + await devServer.stop(); }); it('scripts proxy correctly', async () => { diff --git a/packages/astro/test/svelte-component.test.js b/packages/astro/test/svelte-component.test.js index edf6e3965..15eadac5f 100644 --- a/packages/astro/test/svelte-component.test.js +++ b/packages/astro/test/svelte-component.test.js @@ -38,7 +38,7 @@ describe('Svelte component', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('scripts proxy correctly', async () => { diff --git a/packages/astro/test/vue-component.test.js b/packages/astro/test/vue-component.test.js index 9cad2ccc3..6519b0026 100644 --- a/packages/astro/test/vue-component.test.js +++ b/packages/astro/test/vue-component.test.js @@ -53,7 +53,7 @@ describe('Vue component', () => { }); after(async () => { - devServer && (await devServer.stop()); + (await devServer.stop()); }); it('scripts proxy correctly', async () => {