astro/packages/integrations/netlify/test/functions/test-utils.js

35 lines
759 B
JavaScript
Raw Normal View History

// @ts-check
import { fileURLToPath } from 'node:url';
export * from '../../../../astro/test/test-utils.js';
/**
2022-04-19 15:23:07 +00:00
*
* @returns {import('../../../../astro/dist/types/@types/astro').AstroIntegration}
*/
export function testIntegration({ setEntryPoints } = {}) {
return {
name: '@astrojs/netlify/test-integration',
hooks: {
2022-04-19 15:23:07 +00:00
'astro:config:setup': ({ updateConfig }) => {
updateConfig({
vite: {
resolve: {
alias: {
'@astrojs/netlify/netlify-functions.js': fileURLToPath(
new URL('../../dist/netlify-functions.js', import.meta.url)
),
},
},
},
});
2022-04-19 15:23:07 +00:00
},
'astro:build:ssr': ({ entryPoints }) => {
if (entryPoints.size) {
setEntryPoints(entryPoints);
}
},
2022-04-19 15:23:07 +00:00
},
};
}