[ci] format

This commit is contained in:
matthewp 2022-11-17 15:35:15 +00:00 committed by fredkbot
parent 1ab505855f
commit 539ee179f7
3 changed files with 10 additions and 10 deletions

View file

@ -2,8 +2,8 @@ import type fsType from 'fs';
import npath from 'path'; import npath from 'path';
import { pathToFileURL } from 'url'; import { pathToFileURL } from 'url';
import * as vite from 'vite'; import * as vite from 'vite';
import { AstroError, AstroErrorData } from '../errors/index.js';
import loadFallbackPlugin from '../../vite-plugin-load-fallback/index.js'; import loadFallbackPlugin from '../../vite-plugin-load-fallback/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
// Fallback for legacy // Fallback for legacy
import load from '@proload/core'; import load from '@proload/core';
@ -28,7 +28,7 @@ async function createViteLoader(root: string, fs: typeof fsType): Promise<ViteLo
// avoid `vite.createServer` and use `loadConfigFromFile` instead. // avoid `vite.createServer` and use `loadConfigFromFile` instead.
external: ['@astrojs/tailwind', '@astrojs/mdx', '@astrojs/react'], external: ['@astrojs/tailwind', '@astrojs/mdx', '@astrojs/react'],
}, },
plugins: [ loadFallbackPlugin({ fs, root: pathToFileURL(root) })] plugins: [loadFallbackPlugin({ fs, root: pathToFileURL(root) })],
}); });
return { return {

View file

@ -2,7 +2,6 @@ import nodeFs from 'fs';
import npath from 'path'; import npath from 'path';
import slashify from 'slash'; import slashify from 'slash';
import type * as vite from 'vite'; import type * as vite from 'vite';
import type { AstroSettings } from '../@types/astro';
type NodeFileSystemModule = typeof nodeFs; type NodeFileSystemModule = typeof nodeFs;
@ -49,7 +48,7 @@ export default function loadFallbackPlugin({
try { try {
// Check to see if this file exists and is not a directory. // Check to see if this file exists and is not a directory.
const stats = await fs.promises.stat(candidateId); const stats = await fs.promises.stat(candidateId);
if(!stats.isDirectory()) { if (!stats.isDirectory()) {
return candidateId; return candidateId;
} }
} catch {} } catch {}

View file

@ -2,9 +2,7 @@ import { expect } from 'chai';
import * as cheerio from 'cheerio'; import * as cheerio from 'cheerio';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { import { runInContainer } from '../../../dist/core/dev/index.js';
runInContainer,
} from '../../../dist/core/dev/index.js';
import { openConfig, createSettings } from '../../../dist/core/config/index.js'; import { openConfig, createSettings } from '../../../dist/core/config/index.js';
import { createFs } from '../test-utils.js'; import { createFs } from '../test-utils.js';
import { defaultLogging } from '../../test-utils.js'; import { defaultLogging } from '../../test-utils.js';
@ -30,12 +28,15 @@ describe('Astro config formats', () => {
flags: {}, flags: {},
cmd: 'dev', cmd: 'dev',
logging: defaultLogging, logging: defaultLogging,
fsMod: fs fsMod: fs,
}); });
const settings = createSettings(astroConfig); const settings = createSettings(astroConfig);
await runInContainer({ fs, root, settings }, () => { await runInContainer({ fs, root, settings }, () => {
expect(true).to.equal(true, 'We were able to get into the container which means the config loaded.'); expect(true).to.equal(
true,
'We were able to get into the container which means the config loaded.'
);
}); });
}); });
}); });