@@ -20,9 +20,9 @@ describe("build commands", () => {
20
20
} ) ;
21
21
22
22
it ( "expects all output bundle files to be generated" , async ( ) => {
23
- const { generateOutputDirectory } = await importUtils ;
23
+ const { generateOutputDirectory, validateOutputDirectory } = await importUtils ;
24
24
const files = {
25
- ".next/standalone/standalonefile " : "" ,
25
+ ".next/standalone/server.js " : "" ,
26
26
".next/static/staticfile" : "" ,
27
27
".next/routes-manifest.json" : `{
28
28
"headers":[],
@@ -32,10 +32,11 @@ describe("build commands", () => {
32
32
} ;
33
33
generateTestFiles ( tmpDir , files ) ;
34
34
await generateOutputDirectory ( tmpDir , outputBundleOptions , path . join ( tmpDir , ".next" ) ) ;
35
+ await validateOutputDirectory ( outputBundleOptions ) ;
35
36
36
37
const expectedFiles = {
37
38
".apphosting/.next/static/staticfile" : "" ,
38
- ".apphosting/standalonefile " : "" ,
39
+ ".apphosting/server.js " : "" ,
39
40
".apphosting/bundle.yaml" : `headers: []
40
41
redirects: []
41
42
rewrites: []
@@ -50,9 +51,9 @@ staticAssets:
50
51
} ) ;
51
52
52
53
it ( "expects public directory to be copied over" , async ( ) => {
53
- const { generateOutputDirectory } = await importUtils ;
54
+ const { generateOutputDirectory, validateOutputDirectory } = await importUtils ;
54
55
const files = {
55
- ".next/standalone/standalonefile " : "" ,
56
+ ".next/standalone/server.js " : "" ,
56
57
".next/static/staticfile" : "" ,
57
58
"public/publicfile" : "" ,
58
59
".next/routes-manifest.json" : `{
@@ -63,10 +64,11 @@ staticAssets:
63
64
} ;
64
65
generateTestFiles ( tmpDir , files ) ;
65
66
await generateOutputDirectory ( tmpDir , outputBundleOptions , path . join ( tmpDir , ".next" ) ) ;
67
+ await validateOutputDirectory ( outputBundleOptions ) ;
66
68
67
69
const expectedFiles = {
68
70
".apphosting/.next/static/staticfile" : "" ,
69
- ".apphosting/standalonefile " : "" ,
71
+ ".apphosting/server.js " : "" ,
70
72
".apphosting/public/publicfile" : "" ,
71
73
".apphosting/bundle.yaml" : `headers: []
72
74
redirects: []
@@ -82,9 +84,9 @@ staticAssets:
82
84
} ) ;
83
85
84
86
it ( "expects bundle.yaml headers/rewrites/redirects to be generated" , async ( ) => {
85
- const { generateOutputDirectory } = await importUtils ;
87
+ const { generateOutputDirectory, validateOutputDirectory } = await importUtils ;
86
88
const files = {
87
- ".next/standalone/standalonefile " : "" ,
89
+ ".next/standalone/server.js " : "" ,
88
90
".next/static/staticfile" : "" ,
89
91
".next/routes-manifest.json" : `{
90
92
"headers":[{"source":"source", "headers":["header1"]}],
@@ -94,10 +96,11 @@ staticAssets:
94
96
} ;
95
97
generateTestFiles ( tmpDir , files ) ;
96
98
await generateOutputDirectory ( tmpDir , outputBundleOptions , path . join ( tmpDir , ".next" ) ) ;
99
+ await validateOutputDirectory ( outputBundleOptions ) ;
97
100
98
101
const expectedFiles = {
99
102
".apphosting/.next/static/staticfile" : "" ,
100
- ".apphosting/standalonefile " : "" ,
103
+ ".apphosting/server.js " : "" ,
101
104
".apphosting/bundle.yaml" : `headers:
102
105
- source: source
103
106
headers:
@@ -117,7 +120,21 @@ staticAssets:
117
120
} ;
118
121
validateTestFiles ( tmpDir , expectedFiles ) ;
119
122
} ) ;
120
-
123
+ it ( "test failed validateOutputDirectory" , async ( ) => {
124
+ const { generateOutputDirectory, validateOutputDirectory } = await importUtils ;
125
+ const files = {
126
+ ".next/standalone/notserver.js" : "" ,
127
+ ".next/static/staticfile" : "" ,
128
+ ".next/routes-manifest.json" : `{
129
+ "headers":[{"source":"source", "headers":["header1"]}],
130
+ "rewrites":[{"source":"source", "destination":"destination"}],
131
+ "redirects":[{"source":"source", "destination":"destination"}]
132
+ }` ,
133
+ } ;
134
+ generateTestFiles ( tmpDir , files ) ;
135
+ await generateOutputDirectory ( tmpDir , outputBundleOptions , path . join ( tmpDir , ".next" ) ) ;
136
+ assert . rejects ( async ( ) => await validateOutputDirectory ( outputBundleOptions ) ) ;
137
+ } ) ;
121
138
it ( "test populate output bundle options" , async ( ) => {
122
139
const { populateOutputBundleOptions } = await importUtils ;
123
140
const expectedOutputBundleOptions = {
0 commit comments