@@ -4687,6 +4687,88 @@ addEventListener('fetch', event => {});`
46874687 ` ) ;
46884688 } ) ;
46894689
4690+ it ( "should warn when using smart placement with assets-first" , async ( ) => {
4691+ const assets = [
4692+ { filePath : ".assetsignore" , content : "*.bak\nsub-dir" } ,
4693+ { filePath : "file-1.txt" , content : "Content of file-1" } ,
4694+ { filePath : "file-2.bak" , content : "Content of file-2" } ,
4695+ { filePath : "file-3.txt" , content : "Content of file-3" } ,
4696+ { filePath : "sub-dir/file-4.bak" , content : "Content of file-4" } ,
4697+ { filePath : "sub-dir/file-5.txt" , content : "Content of file-5" } ,
4698+ ] ;
4699+ writeAssets ( assets , "assets" ) ;
4700+ writeWranglerConfig ( {
4701+ assets : {
4702+ directory : "assets" ,
4703+ experimental_serve_directly : true ,
4704+ } ,
4705+ placement : {
4706+ mode : "smart" ,
4707+ } ,
4708+ } ) ;
4709+ const bodies : AssetManifest [ ] = [ ] ;
4710+ await mockAUSRequest ( bodies ) ;
4711+ mockSubDomainRequest ( ) ;
4712+ mockUploadWorkerRequest ( {
4713+ expectedAssets : {
4714+ jwt : "<<aus-completion-token>>" ,
4715+ config : {
4716+ serve_directly : true ,
4717+ } ,
4718+ } ,
4719+ expectedType : "none" ,
4720+ } ) ;
4721+
4722+ await runWrangler ( "deploy" ) ;
4723+
4724+ expect ( std . warn ) . toMatchInlineSnapshot ( `
4725+ "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mUsing assets with smart placement turned on may result in poor performance.[0m
4726+
4727+ "
4728+ ` ) ;
4729+ } ) ;
4730+
4731+ it ( "should warn when using smart placement with assets-first" , async ( ) => {
4732+ const assets = [
4733+ { filePath : ".assetsignore" , content : "*.bak\nsub-dir" } ,
4734+ { filePath : "file-1.txt" , content : "Content of file-1" } ,
4735+ { filePath : "file-2.bak" , content : "Content of file-2" } ,
4736+ { filePath : "file-3.txt" , content : "Content of file-3" } ,
4737+ { filePath : "sub-dir/file-4.bak" , content : "Content of file-4" } ,
4738+ { filePath : "sub-dir/file-5.txt" , content : "Content of file-5" } ,
4739+ ] ;
4740+ writeAssets ( assets , "assets" ) ;
4741+ writeWranglerConfig ( {
4742+ assets : {
4743+ directory : "assets" ,
4744+ experimental_serve_directly : true ,
4745+ } ,
4746+ placement : {
4747+ mode : "smart" ,
4748+ } ,
4749+ } ) ;
4750+ const bodies : AssetManifest [ ] = [ ] ;
4751+ await mockAUSRequest ( bodies ) ;
4752+ mockSubDomainRequest ( ) ;
4753+ mockUploadWorkerRequest ( {
4754+ expectedAssets : {
4755+ jwt : "<<aus-completion-token>>" ,
4756+ config : {
4757+ serve_directly : true ,
4758+ } ,
4759+ } ,
4760+ expectedType : "none" ,
4761+ } ) ;
4762+
4763+ await runWrangler ( "deploy" ) ;
4764+
4765+ expect ( std . warn ) . toMatchInlineSnapshot ( `
4766+ "[33m▲ [43;33m[[43;30mWARNING[43;33m][0m [1mUsing assets with smart placement turned on may result in poor performance.[0m
4767+
4768+ "
4769+ ` ) ;
4770+ } ) ;
4771+
46904772 it ( "should warn if experimental_serve_directly=false but no binding is provided" , async ( ) => {
46914773 const assets = [
46924774 { filePath : ".assetsignore" , content : "*.bak\nsub-dir" } ,
0 commit comments