@@ -215,6 +215,43 @@ test('`fusion build` app with dynamic imports integration', async () => {
215
215
proxy . close ( ) ;
216
216
} , 100000 ) ;
217
217
218
+ test ( '`fusion build` app with CDN_URL and same-origin' , async ( ) => {
219
+ await cmd ( `build --dir=${ dir } --production` ) ;
220
+
221
+ // Run puppeteer test to ensure that page loads with dynamic content.
222
+ const { proc, port} = await start ( `--dir=${ dir } ` , {
223
+ env : Object . assign ( { } , process . env , {
224
+ CDN_URL : 'https://cdn.com' ,
225
+ NODE_ENV : 'production' ,
226
+ } ) ,
227
+ } ) ;
228
+
229
+ const browser = await puppeteer . launch ( {
230
+ args : [ '--no-sandbox' , '--disable-setuid-sandbox' ] ,
231
+ } ) ;
232
+ const page = await browser . newPage ( ) ;
233
+ await page . setRequestInterception ( true ) ;
234
+ await page . on ( 'request' , request => {
235
+ // Ignore CDN requests since they will cause the browser to hang.
236
+ if ( request . url ( ) . startsWith ( 'https://cdn.com' ) ) {
237
+ request . abort ( ) ;
238
+ } else {
239
+ request . continue ( ) ;
240
+ }
241
+ } ) ;
242
+ await page . goto ( `http://localhost:${ port } /` , { waitUntil : 'load' } ) ;
243
+
244
+ t . ok (
245
+ await page . $$eval ( 'script[src]:not([type="application/json"])' , els =>
246
+ els . every ( el => el . crossOrigin === 'anonymous' )
247
+ ) ,
248
+ 'non-module scripts have crossorigin attribute'
249
+ ) ;
250
+
251
+ browser . close ( ) ;
252
+ proc . kill ( ) ;
253
+ } , 100000 ) ;
254
+
218
255
test ( '`fusion build` app with Safari user agent and same-origin' , async ( ) => {
219
256
var env = Object . create ( process . env ) ;
220
257
env . NODE_ENV = 'production' ;
0 commit comments