From c4c616c0a5dd8c873d00377f4ac99cd051632768 Mon Sep 17 00:00:00 2001 From: lilnasy Date: Thu, 28 Sep 2023 17:19:21 +0000 Subject: [PATCH] [ci] format --- .../src/vite-plugin-astro-server/route.ts | 26 +++++++++--------- .../custom-404-implicit-rerouting.test.js | 27 +++++++++---------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 50d8d34d7..a567c3266 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -221,19 +221,19 @@ export async function handleRoute({ if (response.status === 404 && has404Route(manifestData)) { const fourOhFourRoute = await matchRoute('/404', manifestData, pipeline); if (fourOhFourRoute?.route !== options.route) - return handleRoute({ - ...options, - matchedRoute: fourOhFourRoute, - url: new URL(pathname, url), - status: 404, - body, - origin, - pipeline, - manifestData, - incomingRequest, - incomingResponse, - manifest, - }); + return handleRoute({ + ...options, + matchedRoute: fourOhFourRoute, + url: new URL(pathname, url), + status: 404, + body, + origin, + pipeline, + manifestData, + incomingRequest, + incomingResponse, + manifest, + }); } if (route.type === 'endpoint') { await writeWebResponse(incomingResponse, response); diff --git a/packages/astro/test/custom-404-implicit-rerouting.test.js b/packages/astro/test/custom-404-implicit-rerouting.test.js index 4a5276c86..68eaaf892 100644 --- a/packages/astro/test/custom-404-implicit-rerouting.test.js +++ b/packages/astro/test/custom-404-implicit-rerouting.test.js @@ -1,19 +1,19 @@ import { expect } from 'chai'; import { loadFixture } from './test-utils.js'; -for (const caseNumber of [ 1, 2, 3, 4 ]) { +for (const caseNumber of [1, 2, 3, 4]) { describe(`Custom 404 with implicit rerouting - Case #${caseNumber}`, () => { - /** @type Awaited> */ + /** @type Awaited> */ let fixture; - /** @type Awaited> */ - let devServer - + /** @type Awaited> */ + let devServer; + before(async () => { fixture = await loadFixture({ root: `./fixtures/custom-404-loop-case-${caseNumber}/`, - site: 'http://example.com' + site: 'http://example.com', }); - + devServer = await fixture.startDevServer(); }); @@ -31,17 +31,16 @@ for (const caseNumber of [ 1, 2, 3, 4 ]) { expect(result).to.not.equal(timeout); expect(result.status).to.equal(404); }); - + after(async () => { await devServer.stop(); }); }); } - /***** UTILITY FUNCTIONS *****/ -const timeout = Symbol("timeout") +const timeout = Symbol('timeout'); /** @template Res */ function withTimeout( @@ -51,7 +50,7 @@ function withTimeout( timeLimit ) { /** @type Promise */ - const timeoutPromise = new Promise(resolve => setTimeout(() => resolve(timeout), timeLimit)) - - return Promise.race([ responsePromise, timeoutPromise ]); -} \ No newline at end of file + const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(timeout), timeLimit)); + + return Promise.race([responsePromise, timeoutPromise]); +}