[ci] format
This commit is contained in:
parent
dca762cf73
commit
92374c0f75
3 changed files with 33 additions and 31 deletions
|
@ -1,11 +1,11 @@
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { AstroSettings } from '../@types/astro';
|
import type { AstroSettings } from '../@types/astro';
|
||||||
|
|
||||||
|
import * as fs from 'fs';
|
||||||
import { LogOptions } from '../core/logger/core.js';
|
import { LogOptions } from '../core/logger/core.js';
|
||||||
import notFoundTemplate, { subpathNotUsedTemplate } from '../template/4xx.js';
|
import notFoundTemplate, { subpathNotUsedTemplate } from '../template/4xx.js';
|
||||||
import { log404 } from './common.js';
|
import { log404 } from './common.js';
|
||||||
import { writeHtmlResponse } from './response.js';
|
import { writeHtmlResponse } from './response.js';
|
||||||
import * as fs from 'fs';
|
|
||||||
|
|
||||||
export function baseMiddleware(
|
export function baseMiddleware(
|
||||||
settings: AstroSettings,
|
settings: AstroSettings,
|
||||||
|
@ -20,7 +20,6 @@ export function baseMiddleware(
|
||||||
|
|
||||||
const pathname = decodeURI(new URL(url, 'http://localhost').pathname);
|
const pathname = decodeURI(new URL(url, 'http://localhost').pathname);
|
||||||
|
|
||||||
|
|
||||||
if (pathname.startsWith(devRoot)) {
|
if (pathname.startsWith(devRoot)) {
|
||||||
req.url = url.replace(devRoot, '/');
|
req.url = url.replace(devRoot, '/');
|
||||||
return next();
|
return next();
|
||||||
|
|
|
@ -159,12 +159,14 @@ describe('dev container', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('items in public/ are not available from root when using a base', async () => {
|
it('items in public/ are not available from root when using a base', async () => {
|
||||||
await runInContainer({
|
await runInContainer(
|
||||||
|
{
|
||||||
root,
|
root,
|
||||||
userConfig: {
|
userConfig: {
|
||||||
base: '/sub/'
|
base: '/sub/',
|
||||||
}
|
},
|
||||||
}, async (container) => {
|
},
|
||||||
|
async (container) => {
|
||||||
// First try the subpath
|
// First try the subpath
|
||||||
let r = createRequestAndResponse({
|
let r = createRequestAndResponse({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -186,7 +188,8 @@ describe('dev container', () => {
|
||||||
await r.done;
|
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 () => {
|
it('items in public/ are available from root when not using a base', async () => {
|
||||||
|
|
|
@ -114,6 +114,6 @@ describe('MDX syntax highlighting', () => {
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
|
|
||||||
const html = await fixture.readFile('/index.html');
|
const html = await fixture.readFile('/index.html');
|
||||||
expect(html).to.include('style="background-color:#000000"')
|
expect(html).to.include('style="background-color:#000000"');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue