@@ -31,6 +31,10 @@ describe('AMP Usage', () => {
31
31
let output = ''
32
32
33
33
beforeAll ( async ( ) => {
34
+ await rename (
35
+ join ( appDir , 'pages/custom-scripts.js' ) ,
36
+ join ( appDir , 'pages/custom-scripts.js.bak' )
37
+ )
34
38
await rename (
35
39
join ( appDir , 'pages/invalid-amp.js' ) ,
36
40
join ( appDir , 'pages/invalid-amp.js.bak' )
@@ -46,6 +50,10 @@ describe('AMP Usage', () => {
46
50
app = await nextStart ( appDir , context . appPort )
47
51
} )
48
52
afterAll ( async ( ) => {
53
+ await rename (
54
+ join ( appDir , 'pages/custom-scripts.js.bak' ) ,
55
+ join ( appDir , 'pages/custom-scripts.js' )
56
+ )
49
57
await rename (
50
58
join ( appDir , 'pages/invalid-amp.js.bak' ) ,
51
59
join ( appDir , 'pages/invalid-amp.js' )
@@ -536,6 +544,25 @@ describe('AMP Usage', () => {
536
544
expect ( inspectPayload ) . toContain ( 'error' )
537
545
} )
538
546
547
+ it ( 'should detect amp validator warning on custom scripts' , async ( ) => {
548
+ let inspectPayload = ''
549
+ dynamicAppPort = await findPort ( )
550
+ ampDynamic = await launchApp ( join ( __dirname , '../' ) , dynamicAppPort , {
551
+ onStdout ( msg ) {
552
+ inspectPayload += msg
553
+ } ,
554
+ onStderr ( msg ) {
555
+ inspectPayload += msg
556
+ } ,
557
+ } )
558
+
559
+ await renderViaHTTP ( dynamicAppPort , '/custom-scripts' )
560
+
561
+ await killApp ( ampDynamic )
562
+
563
+ expect ( inspectPayload ) . toContain ( 'error' )
564
+ } )
565
+
539
566
it ( 'should not contain missing files warning' , async ( ) => {
540
567
expect ( output ) . toContain ( 'Compiled /only-amp' )
541
568
expect ( output ) . not . toContain ( 'Could not find files for' )
0 commit comments