@@ -24,6 +24,16 @@ export interface DeployResult {
24
24
25
25
type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun' | 'berry'
26
26
27
+ const defaultValidateDeployOutput = async ( siteAbsDir : string ) => {
28
+ // by default we expect Frameworks API to be used in the build
29
+ const serverHandlerDir = join ( siteAbsDir , '.netlify/functions/___netlify-server-handler' )
30
+ if ( ! existsSync ( serverHandlerDir ) ) {
31
+ throw new Error ( `Server handler not found at ${ siteAbsDir } ` )
32
+ }
33
+ }
34
+
35
+ const staticExportValidateDeployOutput = defaultValidateDeployOutput //() => {}
36
+
27
37
interface E2EConfig {
28
38
packageManger ?: PackageManager
29
39
packagePath ?: string
@@ -44,6 +54,10 @@ interface E2EConfig {
44
54
* Site ID to deploy to. Defaults to the `NETLIFY_SITE_ID` environment variable or a default site.
45
55
*/
46
56
siteId ?: string
57
+ /**
58
+ *
59
+ */
60
+ validateDeployFiles ?: typeof defaultValidateDeployOutput
47
61
}
48
62
49
63
/**
@@ -84,6 +98,14 @@ export const createE2EFixture = async (fixture: string, config: E2EConfig = {})
84
98
85
99
const result = await deploySite ( isolatedFixtureRoot , config )
86
100
101
+ {
102
+ const validateOutput = config . validateDeployFiles ?? defaultValidateDeployOutput
103
+
104
+ const siteRelDir = config . cwd ?? config . packagePath ?? ''
105
+
106
+ await validateOutput ( join ( isolatedFixtureRoot , siteRelDir ) )
107
+ }
108
+
87
109
console . log ( `🌍 Deployed site is live: ${ result . url } ` )
88
110
deployID = result . deployID
89
111
logs = result . logs
@@ -307,14 +329,17 @@ async function cleanup(dest: string, deployId?: string): Promise<void> {
307
329
308
330
export const fixtureFactories = {
309
331
simple : ( ) => createE2EFixture ( 'simple' ) ,
310
- outputExport : ( ) => createE2EFixture ( 'output-export' ) ,
332
+ outputExport : ( ) =>
333
+ createE2EFixture ( 'output-export' , { validateDeployFiles : staticExportValidateDeployOutput } ) ,
311
334
ouputExportPublishOut : ( ) =>
312
335
createE2EFixture ( 'output-export' , {
313
336
publishDirectory : 'out' ,
337
+ validateDeployFiles : staticExportValidateDeployOutput ,
314
338
} ) ,
315
339
outputExportCustomDist : ( ) =>
316
340
createE2EFixture ( 'output-export-custom-dist' , {
317
341
publishDirectory : 'custom-dist' ,
342
+ validateDeployFiles : staticExportValidateDeployOutput ,
318
343
} ) ,
319
344
distDir : ( ) =>
320
345
createE2EFixture ( 'dist-dir' , {
0 commit comments