File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const makeE2EFixture = (
1414
1515export const test = base . extend <
1616 {
17+ ensureStaticAssetsHaveImmutableCacheControl : void
1718 takeScreenshot : void
1819 pollUntilHeadersMatch : (
1920 url : string ,
@@ -91,4 +92,19 @@ export const test = base.extend<
9192 } ,
9293 { auto : true } ,
9394 ] ,
95+ ensureStaticAssetsHaveImmutableCacheControl : [
96+ async ( { page } , use ) => {
97+ page . on ( 'response' , ( response ) => {
98+ if ( response . url ( ) . includes ( '/_next/static/' ) ) {
99+ expect (
100+ response . headers ( ) [ 'cache-control' ] ,
101+ '_next/static assets should have immutable cache control' ,
102+ ) . toContain ( 'public,max-age=31536000,immutable' )
103+ }
104+ } )
105+
106+ await use ( )
107+ } ,
108+ { auto : true } ,
109+ ] ,
94110} )
You can’t perform that action at this time.
0 commit comments