summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar matthewp <matthewp@users.noreply.github.com> 2022-11-09 13:35:06 +0000
committerGravatar fredkbot <fred+astrobot@astro.build> 2022-11-09 13:35:06 +0000
commit92374c0f75139bf5db9b11ecd8e53eda9e536a23 (patch)
tree0313e3745e9c8db79c47237f26d26d36d3e15fde
parentdca762cf734a657d8f126fd6958892b6163a4f67 (diff)
downloadastro-92374c0f75139bf5db9b11ecd8e53eda9e536a23.tar.gz
astro-92374c0f75139bf5db9b11ecd8e53eda9e536a23.tar.zst
astro-92374c0f75139bf5db9b11ecd8e53eda9e536a23.zip
[ci] format
-rw-r--r--packages/astro/src/vite-plugin-astro-server/base.ts5
-rw-r--r--packages/astro/test/units/dev/dev.test.js49
-rw-r--r--packages/integrations/mdx/test/mdx-syntax-highlighting.test.js2
3 files changed, 29 insertions, 27 deletions
diff --git a/packages/astro/src/vite-plugin-astro-server/base.ts b/packages/astro/src/vite-plugin-astro-server/base.ts
index dcab634b7..4fad19a2b 100644
--- a/packages/astro/src/vite-plugin-astro-server/base.ts
+++ b/packages/astro/src/vite-plugin-astro-server/base.ts
@@ -1,11 +1,11 @@
import type * as vite from 'vite';
import type { AstroSettings } from '../@types/astro';
+import * as fs from 'fs';
import { LogOptions } from '../core/logger/core.js';
import notFoundTemplate, { subpathNotUsedTemplate } from '../template/4xx.js';
import { log404 } from './common.js';
import { writeHtmlResponse } from './response.js';
-import * as fs from 'fs';
export function baseMiddleware(
settings: AstroSettings,
@@ -20,7 +20,6 @@ export function baseMiddleware(
const pathname = decodeURI(new URL(url, 'http://localhost').pathname);
-
if (pathname.startsWith(devRoot)) {
req.url = url.replace(devRoot, '/');
return next();
@@ -46,7 +45,7 @@ export function baseMiddleware(
// Check to see if it's in public and if so 404
const publicPath = new URL('.' + req.url, config.publicDir);
fs.stat(publicPath, (_err, stats) => {
- if(stats) {
+ if (stats) {
log404(logging, pathname);
const html = subpathNotUsedTemplate(devRoot, pathname);
return writeHtmlResponse(res, 404, html);
diff --git a/packages/astro/test/units/dev/dev.test.js b/packages/astro/test/units/dev/dev.test.js
index 062fcba23..ad3fba650 100644
--- a/packages/astro/test/units/dev/dev.test.js
+++ b/packages/astro/test/units/dev/dev.test.js
@@ -159,34 +159,37 @@ describe('dev container', () => {
});
it('items in public/ are not available from root when using a base', async () => {
- await runInContainer({
- root,
- userConfig: {
- base: '/sub/'
- }
- }, async (container) => {
- // First try the subpath
- let r = createRequestAndResponse({
- method: 'GET',
- url: '/sub/test.txt',
- });
+ await runInContainer(
+ {
+ root,
+ userConfig: {
+ base: '/sub/',
+ },
+ },
+ async (container) => {
+ // First try the subpath
+ let r = createRequestAndResponse({
+ method: 'GET',
+ url: '/sub/test.txt',
+ });
- container.handle(r.req, r.res);
- await r.done;
+ container.handle(r.req, r.res);
+ await r.done;
- expect(r.res.statusCode).to.equal(200);
+ expect(r.res.statusCode).to.equal(200);
- // Next try the root path
- r = createRequestAndResponse({
- method: 'GET',
- url: '/test.txt',
- });
+ // Next try the root path
+ r = createRequestAndResponse({
+ method: 'GET',
+ url: '/test.txt',
+ });
- container.handle(r.req, r.res);
- await r.done;
+ container.handle(r.req, r.res);
+ await r.done;
- expect(r.res.statusCode).to.equal(404);
- });
+ expect(r.res.statusCode).to.equal(404);
+ }
+ );
});
it('items in public/ are available from root when not using a base', async () => {
diff --git a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
index 6203ed82c..32c6bcd04 100644
--- a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
+++ b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js
@@ -114,6 +114,6 @@ describe('MDX syntax highlighting', () => {
await fixture.build();
const html = await fixture.readFile('/index.html');
- expect(html).to.include('style="background-color:#000000"')
+ expect(html).to.include('style="background-color:#000000"');
});
});