From d6139ba9598b36876560620000f62f7ec6c9a1f2 Mon Sep 17 00:00:00 2001
From: khen <30577427+khendrikse@users.noreply.github.com>
Date: Fri, 6 Oct 2023 12:42:46 +0200
Subject: [PATCH] fix: stop using snapshot for checking invalid package json

---
 .../tests/functions/snapshots/tests.js.md     |  52 ------------------
 .../tests/functions/snapshots/tests.js.snap   | Bin 1080 -> 967 bytes
 packages/build/tests/functions/tests.js       |   2 +-
 3 files changed, 1 insertion(+), 53 deletions(-)

diff --git a/packages/build/tests/functions/snapshots/tests.js.md b/packages/build/tests/functions/snapshots/tests.js.md
index 0cbb36d7fe..7b34176737 100644
--- a/packages/build/tests/functions/snapshots/tests.js.md
+++ b/packages/build/tests/functions/snapshots/tests.js.md
@@ -283,58 +283,6 @@ Generated by [AVA](https://avajs.dev).
     (Netlify Build completed in 1ms)␊
     Build step duration: Netlify Build completed in 1ms`
 
-## Functions: invalid package.json
-
-> Snapshot 1
-
-    `␊
-    Netlify Build                                                 ␊
-    ────────────────────────────────────────────────────────────────␊
-    ␊
-    > Version␊
-      @netlify/build 1.0.0␊
-    ␊
-    > Flags␊
-      debug: true␊
-      repositoryRoot: packages/build/tests/functions/fixtures/functions_package_json_invalid␊
-      testOpts:␊
-        pluginsListUrl: test␊
-        silentLingeringProcesses: true␊
-    ␊
-    > Current directory␊
-      packages/build/tests/functions/fixtures/functions_package_json_invalid␊
-    ␊
-    > Config file␊
-      packages/build/tests/functions/fixtures/functions_package_json_invalid/netlify.toml␊
-    ␊
-    > Resolved config␊
-      build:␊
-        publish: packages/build/tests/functions/fixtures/functions_package_json_invalid␊
-        publishOrigin: default␊
-      functionsDirectory: packages/build/tests/functions/fixtures/functions_package_json_invalid/functions␊
-    ␊
-    > Context␊
-      production␊
-    ␊
-    Functions bundling                                            ␊
-    ────────────────────────────────────────────────────────────────␊
-    ␊
-    Packaging Functions from functions directory:␊
-     - test.js␊
-    ␊
-    ␊
-    Configuration error                                           ␊
-    ────────────────────────────────────────────────────────────────␊
-    ␊
-      Error message␊
-      Unexpected token { in JSON at position 1␊
-    ␊
-      Resolved config␊
-      build:␊
-        publish: packages/build/tests/functions/fixtures/functions_package_json_invalid␊
-        publishOrigin: default␊
-      functionsDirectory: packages/build/tests/functions/fixtures/functions_package_json_invalid/functions`
-
 ## Functions: --functionsDistDir
 
 > Snapshot 1
diff --git a/packages/build/tests/functions/snapshots/tests.js.snap b/packages/build/tests/functions/snapshots/tests.js.snap
index 770192f856e392af80565d34daee81a3603ab8fe..30fad9f6ee23e55bf2d6bf6aadd260055d154efd 100644
GIT binary patch
literal 967
zcmV;&133IaRzV<BZeeh9Xm4~Nb~6eC0Ea)(_`X*ah1~8Lf>8W7XT!ocyHb>+zB`fI
zrVqN^&>xEk00000000B+nBQ*GFciiIj3Gthg8LyE5YmunyNbIYA+*6R(6mhxAaOON
ziIbT*cI0ET?hdYa0Um(y0=yGXf}Q^<?Y0(WE!0&tsk6_i{hgfeXZJiDQ0||=*B@9C
zN%8Q}j$*zfoPmpC0zg=VfGgo+6cB-Z$;BA~<|S~<C44y#0#AA$*0ye~+*vWN8@E^P
z-F&v@>|sesc!stVp#hrq<^1~g`Ja9}&I|M&3(!J32)$&P8ofcPM!&n+-83_Hs271A
z5AZ-mE|NlF{Yl`212IA$axPtzc>akOVaTF;5`%<ZSd^(3lA%;W59j658O)UZM1t!W
zF%zmH!eEzxd?%=zj-~@ZC}wh3$6%rV90=}X01Wv`^a8h)5PC{gdL1|Ia!eY|LK2}+
zf8X>8dbxOA$zy7=9b(}06AqA{rqvnKMEPdbfD$;KMYS?`Ul1*rtIHC4iW;rTxL1V`
zQ-8sT9uf~t;zaO3r4f!(cAnl33#jS5<!YI?#~2m9QHcRqN~4AJM1&<E4>8U<c&Hy|
z^Y5UlNU89~7%6=oClpKl*bs*LF+6cHYXXTA6e!`D`7XLbq%&e}+xhqsRcfQDz!kN<
zIH(}d<2r#9NL_A;23Xf!;7CzVq&_l+K|dP|`feFC2L|OOI?AnnAwbkv)66ugXK5Kp
z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fj*7`<14h->EUHz;>yn~iK87U@GG?@@
z?4FiF9Qg*j^w4Bv9H&x5S#IHZRp#M*c*IQRovxI5y+xp`8?_jUXl=C6fgBR8AOJ3S
zhm3GJo4=zvB9+1`6Qm49k}{%k*-#F>MBVYmrAcX$LX^qC^!MQqmfo)7_M~V(MUh%*
zD{x3{4>l?Zbh}BQOlb_ah5^C2OESz@AoDshfkD4o4EpXEGzSJ1A?g>Uejz~A8q>@)
zYI?DZq+KFf;!<lub-U@m`d&Fq?VDBJcmWk<4TzLNo-PFdp5>EHFiUZ%;q}4j#yXv0
z%^4FM3wf2rck|-juIxTcSd8!=rdSEQ8x7!v0UxtY?IZ)iXb6~K+Y?~-s0F*8gWVip
zhcPnISrpEd!<iXzg#*iUt5vg<b>%dwrcOf^2eiGJvylsH=3Pq>OOZfZ!NyU`gAP=+
z*&VlR2gv4e>uQ5OMgAT1r0@KT7I+?<ci=gB@YHp3A;41(XJ+se4lIMGR&8JK?8^vO
zg6x%`kBthXsOe%34p};3*V}6qpPO#iJC9v&9->95J;i8d-}C17wzs^cWVUv^<4II4
zZm+v<zD(cix^3>fVsk=_;i3-q1jbx#G3JtE%p4fQ1z#A#<YSqcFUHz3T?(-*u_d2?
zBg^zGSrd&i|B*-nu|OqE9h$%vhZE}ovH8^GdV?pFe+U?j%8bIzg5Z0(vV5b(l`G4R
zD<{vD>aTub(Ko^B7ZF?(;!GLk%q%+CuVqS2mEID+rcBzAZF-&_<ILn<mG5~~{)UrL
zieh16X|YW>d@^i#@oIey0u6axGg|fj{!8ygPr(wd*BWr`bQ*V78t*>g$kuP6b;BLm
yj)B(Qa{JKLN!q~#$HqiN#2>H0fza+DqI-zwfao3~F3{J`sqYU}2n+lsGXMZxX$n#R

diff --git a/packages/build/tests/functions/tests.js b/packages/build/tests/functions/tests.js
index f05da53c9d..82a8ef5efb 100644
--- a/packages/build/tests/functions/tests.js
+++ b/packages/build/tests/functions/tests.js
@@ -45,7 +45,7 @@ test('Functions: invalid package.json', async (t) => {
   await writeFile(packageJsonPath, '{{}')
   try {
     const output = await new Fixture('./fixtures/functions_package_json_invalid').runWithBuild()
-    t.snapshot(normalizeOutput(output))
+    t.true(output.includes('Configuration error'))
   } finally {
     await rm(packageJsonPath, { force: true, recursive: true, maxRetries: 10 })
   }