Skip to content

Commit

Permalink
Merge branch 'main' into feat/cli-verify
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored Aug 16, 2023
2 parents 4a9d4bf + 42ed85b commit 514a203
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,10 +839,10 @@ export interface AstroUserConfig {
* @default `never`
* @version 2.6.0
* @description
* Control whether styles are sent to the browser in a separate css file or inlined into `<style>` tags. Choose from the following options:
* - `'always'` - all styles are inlined into `<style>` tags
* - `'auto'` - only stylesheets smaller than `ViteConfig.build.assetsInlineLimit` (default: 4kb) are inlined. Otherwise, styles are sent in external stylesheets.
* - `'never'` - all styles are sent in external stylesheets
* Control whether project styles are sent to the browser in a separate css file or inlined into `<style>` tags. Choose from the following options:
* - `'always'` - project styles are inlined into `<style>` tags
* - `'auto'` - only stylesheets smaller than `ViteConfig.build.assetsInlineLimit` (default: 4kb) are inlined. Otherwise, project styles are sent in external stylesheets.
* - `'never'` - project styles are sent in external stylesheets
*
* ```js
* {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export default function astroIntegrationsContainerPlugin({
}): VitePlugin {
return {
name: 'astro:integration-container',
configureServer(server) {
async configureServer(server) {
if (server.config.isProduction) return;
runHookServerSetup({ config: settings.config, server, logging });
await runHookServerSetup({ config: settings.config, server, logging });
},
async buildStart() {
if (settings.injectedRoutes.length === settings.resolvedInjectedRoutes.length) return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { setTimeout } from "node:timers/promises";

export default function() {
return {
name: '@astrojs/test-integration',
hooks: {
'astro:server:setup': ({ server }) => {
'astro:server:setup': async ({ server }) => {
// Ensure that `async` is respected
await setTimeout(100);
server.middlewares.use(
function middleware(req, res, next) {
res.setHeader('x-middleware', 'true');
Expand Down
5 changes: 1 addition & 4 deletions packages/integrations/cloudflare/test/cf.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ describe('Cf metadata and caches', () => {
let html = await res.text();
let $ = cheerio.load(html);

expect($('#cf').text()).to.contain(
'city',
`Expected "city" to exist in runtime, but got ${$('#cf').text()}`
);
expect($('#hasRuntime').text()).to.equal('true');
expect($('#hasCache').text()).to.equal('true');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const runtime = getRuntime(Astro.request);
</head>
<body>
<h1>Testing</h1>
<div id="cf">{JSON.stringify(runtime.cf)}</div>
<div id="hasRuntime">{!!runtime.cf?.colo}</div>
<div id="hasCache">{!!runtime.caches}</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const env = runtime.env;
</head>
<body>
<h1>Testing</h1>
<div id="cf">{JSON.stringify(runtime.cf)}</div>
<div id="env">{JSON.stringify(env)}</div>
<div id="hasRuntime">{!!runtime.cf?.colo}</div>
<div id="hasCache">{!!runtime.caches}</div>
</body>
</html>
2 changes: 1 addition & 1 deletion packages/integrations/cloudflare/test/runtime.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ describe('Runtime Locals', () => {
expect(res.status).to.equal(200);
let html = await res.text();
let $ = cheerio.load(html);
expect($('#cf').text()).to.contain('city');
expect($('#env').text()).to.contain('SECRET_STUFF');
expect($('#env').text()).to.contain('secret');
expect($('#hasRuntime').text()).to.contain('true');
expect($('#hasCache').text()).to.equal('true');
});
});
2 changes: 1 addition & 1 deletion packages/integrations/cloudflare/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function runCLI(basePath, { silent, port }) {
p.stderr.setEncoding('utf-8');
p.stdout.setEncoding('utf-8');

const timeout = 10_000;
const timeout = 20_000;

const ready = new Promise(async (resolve, reject) => {
const failed = setTimeout(() => {
Expand Down

0 comments on commit 514a203

Please sign in to comment.