From 64a28eac877edf3f73a476a9c73672a349936fd8 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Tue, 4 Jan 2022 11:04:45 +0800 Subject: [PATCH] test: update snapshots format for ava@4 --- ava.config.js => ava.config.mjs | 0 .../__test__/object.spec.ts.snap | Bin 364 -> 354 bytes .../__test__/serde/ser.spec.ts.snap | Bin 1123 -> 1079 bytes .../__test__/string.spec.ts.snap | Bin 234 -> 250 bytes .../napi-compat-mode/__test__/throw.spec.ts | 2 +- examples/napi/__test__/typegen.spec.ts.snap | Bin 2208 -> 2226 bytes examples/napi/__test__/values.spec.ts | 15 +++++++++------ examples/napi/__test__/values.spec.ts.snap | Bin 586 -> 603 bytes 8 files changed, 10 insertions(+), 7 deletions(-) rename ava.config.js => ava.config.mjs (100%) diff --git a/ava.config.js b/ava.config.mjs similarity index 100% rename from ava.config.js rename to ava.config.mjs diff --git a/examples/napi-compat-mode/__test__/object.spec.ts.snap b/examples/napi-compat-mode/__test__/object.spec.ts.snap index e16ea220e45760a37d15ebdbc88653f5ba2921a6..bfbba2af1322d3fe38ec4067d9a1c9d9a7e7a4c8 100644 GIT binary patch literal 354 zcmV-o0iFIqRzV;4JgA@BXvtvU`eBa9!7Y z#mrNssTZ{#|FqUX?s7d~E}1Q8h2Wi(Wi$e?w;%`vtP5}iZ19F7+926Q2(V`+0Cwc0 z`^L(!vT}!XmSN7#qKWC83ICYuIdjh>%scbNe6KRqs+saP>yBIiJ8&8cveCPZ-m{Tp zqLj(>T4g##{%2eoYdjarJLG!ATr*EhzABDei{pxVoSD1-)3_ji0c14sLZSiy0Nfy= AeE9MSfJdJz4J}_r6kYNOio&aL| zX_HQG|6S%4eZOqwvl%A>8Ns5jfY_gFN?AegIWLtrU-Z8%-};mhESdo{^!4IEoheDo zF76G}4@~^Cpn?%BdIX4>8Q8&gGIB7oI{;}nAPxoMG$1Ym;x-_j2E@XQY=VrejzvX@ zm5huq7C%2f10xp$BO3!F4^RaYg9sxt10y>xl*`Bn=Cd#|!UUMm6fmRlS%+k|H2Uh5V$f)Z`L{0;nP+pR!s2X*(eH z1>#sB&L!kS78D<{FrfMn;b80@WMO1RvYpugNSgt%2O(RTP;3PT1EUeD#XupZY-0e= K2X0GD0ssICu9gD; diff --git a/examples/napi-compat-mode/__test__/serde/ser.spec.ts.snap b/examples/napi-compat-mode/__test__/serde/ser.spec.ts.snap index 66afca61460c7e0a1d394dc7674501c2ae61e40a..85e3135bd528be9af2055bcb3e063ba5d2a8aed7 100644 GIT binary patch literal 1079 zcmV-71jzeARzVDC7om8B0p3JZeTDuO6|vItfMpH~nc>{DL^!6!jq6d$a9_ik<` zxt-lqbeNCad^z{rbH8)WO)mBvKj>^m7cRN67yItHdm=aVY~MTY)`#|{yFQu>*H>5T zy)YQo9dFe2MjMeAjqGvM58~*xi`}jr+ou$%EYTlPC35N@SEliAT-CX&dj(ff9Ip3W z-wz7By>MshPLmeNp%ZM*nIQDL`?;o3+F@vK6}i5Vx~`Bz&)|9*aDlVHHn0PH4159X z0@s0GfZIrEk!X+6H3;FOg@px)RM~$X7P53ZQK$yVEg^gNgm6Mm2$>T~LMWV26GG*L zmJk{zN(oWoL^&bKoTwy3g%fiLF~{}0ThPy$^m;|o^;7AN5~YRfqrekfn$qKN;f7S3 z>Y6u-tv!Ki5a^h+M3ld8{3VgY5|v_s#>67hVC-zg?n!sF5%;+iJjl8bWZ(=6VtkPt z$>dk1K|Tzu0sS=4r=5Y@iD{t8uvV+F&=eswVo%d|gpfDjA${bCwjDl_Pk3~3?F!7V z0^b2Y0e=cbB#T9)=8LFIl$B*&s3eg3l$2A_ST=-;0%xN;NrYTMg`NaDkG8-#~Wtc6q zX<043(OhjbTc){+e^XzvaMy0H=(^5Y>lH-vCh)d$&{>D`C^1A})(-xblfdIcs| zfnDIb;Ik^8`f~o%pMEOvZwHx~DT3Kt-i(%g_MJcr$?a{-T;Z<#RBGDy2K>C6*`4yM z605e~)O>qZrS!Ap|NZpYJO8laQEj@ScG~tQ?o2smsV2T7&E+Ob&y#TZEMNnnmQPPf xEY#OwZ~=G+xGWgYiMcFDQs#qR0u_#Q)sP?9SY*O+gI%WA6Ot z%$alUIrrYo6GHriJ^RJpxj(hs9GR|;zI0s=CFb7(2sdx6zOetq*_j8f>iwCdf|RQ} zVX)?!9Vg$LUA%dajaNIbJe8+h9S8UI`c9pjFNTe-=Qm}xRDY#hJtz^9`R1dy&lQ`G zE_}6jYI<$Y50tA(A0gRC-#i*#KU=ybor;Y48)coO;4k*;Fnk$0)T&!C;Wk0RJ_?LLygCMyO1z zTS}MiDYXU35+qw-mcVR5wglN06iZNS!D9&?Tku+f*A{%1;Ijq4CHNiL%W+(90)3!p zXXxok4H)T)nW8leg+hcj6VpM^bjDpNVM>$r;x~e zi*+;B-m5Tp1DpV#3C2t?W@ljVBe)Q+uqM5ZpH*NzuU}gd*`Y*8_CG_ zH~hlY?pICITz-JB&Skr(wK}C8gm>F{*}XjBUHM;*BgC?_A*@sCUsSdw3nNCu>1Z@- z;x4GQ$9Q?}fXjP85|kBpc|2mHJ`IE2U>`Uv82iOqu23Y$A!$#Bx50bn+&;FfMs#dh zh3RN*17Am(d7Rw>w$zTY&XH`^D4Uybpf6vn=u5GN5Nj)Gp=@#CZ+oI$MGvILDn_?a z?62gOouLW|(^XwYp-^hOw^S}<9481+;G p%4wqw63_M!-aQQ75wn#VXN#Va*d?YbJO5>9`v*9avB$Lv007wYDW?Dc diff --git a/examples/napi-compat-mode/__test__/string.spec.ts.snap b/examples/napi-compat-mode/__test__/string.spec.ts.snap index 1bb788483eceeead316483e3b43f01e1257d9028..37ff352774f7ee990b57248c089cc97a88fd5bab 100644 GIT binary patch literal 250 zcmVh#1q_}ZmN=jl$VuUR-13Lo~q6uj)uyO0`1^(fzMY&T^PZlRY064 zowRgKuC&sxUDGQkB&;uB1dH|nanbi=-8VD6&4T)FK2_=8oyQ0k-3!Fb4D4W&8Ce+w z8TGvq%Myc=i!uvJ6h6%F*{twn?}DdG_bTKi7Gx@DD+HAmgT$9LC={0zW#*+TQcp9> kp_PaBqlhRUUUq2Pp}mLpxw!g(1hE+b04N3E{wo0h0F6>;6aWAK diff --git a/examples/napi-compat-mode/__test__/throw.spec.ts b/examples/napi-compat-mode/__test__/throw.spec.ts index 9a0f97b3..4ecf601e 100644 --- a/examples/napi-compat-mode/__test__/throw.spec.ts +++ b/examples/napi-compat-mode/__test__/throw.spec.ts @@ -8,7 +8,7 @@ test('should be able to throw error from native', (t) => { test('should be able to throw error from native with reason', (t) => { const reason = 'Fatal' - t.throws(() => bindings.testThrowWithReason(reason), null, reason) + t.throws(() => bindings.testThrowWithReason(reason), void 0, reason) }) test('should throw if argument type is not match', (t) => { diff --git a/examples/napi/__test__/typegen.spec.ts.snap b/examples/napi/__test__/typegen.spec.ts.snap index fbdb529de3a9774ede0c11652cf20ca32a8d60ee..1730c62434e900eddab09ecfec8a637398460cf7 100644 GIT binary patch literal 2226 zcmV;j2u=4vRzVJeo5z#6QK7*MBA{KlY8awY}$vHs~7 zX1EdT{;ztZG7*y@lPsl%kw~Q}iwrT-gprsH$bbvRwWJ9^8vWDHaZC;U_Ve%$FaGob ze}4DJ7oYvU_xV>ZiP3^f(~7yKp2aOhKrzxGj(kA6{xNlj!WkwUNCM-wS9uuELH=B4A9PEAxP-hbh2Jt~gRM7(O#Tt9WhO*P%w=wjn-NQU7XK{mTB8J9CYkZ5&Wu;< zEO0@2WJwjsGn^$VH4^O9Foi{^lweer*n^v}bU-6UAl7YA-t9Y)gd_4n82MuES3-o zj0fOGa6!rLW|C*x-Djg(-cF{C!ZdP(UnuyQWQ8OUKS^;hc3qT_AL z;;Pg<;GvQsRC_=z$r(WhIWNMj%y| zq|&GSi+aho{o$nDv$D5~;&6b8axRB|XNWQuLl(;N`+~n%0z*o?7X3+KQ z0Qk}jw)UP6{((ZTvh^Hz%}mb@ZzmGdk{jfTfv!GDxkTnLQS13UxD0j&Eu_j!JA~a1 z=q*)3K<8VNnO99bNbNbKnnd%VE#elsXFr}nALj_{%V@0WfF0-C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9LKIV936p@em*B5Vr1iO4X<>BO3-&1~}!+Cxv+#<}ADez;>8&&^^m`n>L(9(8(-Ta|q2*!g;Ix9T&8^%wx! z+WumOWL%_#5&$hH^d9B3dUI*mllS=}il(sGX&j>C8cdSy3j9n5fcGIEKqB*85gsda ix9#fAeb6?}hATc`l { t.throws( // @ts-expect-error () => fibonacci(''), - null, + void 0, 'Expect value to be Number, but received String', ) }) @@ -154,7 +154,7 @@ test('class factory', (t) => { const error = t.throws(() => new ClassWithFactory()) t.true( - error.message.startsWith( + error!.message.startsWith( 'Class contains no `constructor`, can not new it!', ), ) @@ -178,7 +178,7 @@ test('callback', (t) => { t.throws( // @ts-expect-error () => getCwd(), - null, + void 0, 'Expect value to be Function, but received Undefined', ) @@ -233,7 +233,7 @@ test('Option', (t) => { }) test('Result', (t) => { - t.throws(() => throwError(), null, 'Manual Error') + t.throws(() => throwError(), void 0, 'Manual Error') }) test('function ts type override', (t) => { @@ -337,7 +337,10 @@ test('external', (t) => { const ext2 = createExternalString('wtf') // @ts-expect-error const e = t.throws(() => getExternal(ext2)) - t.is(e.message, 'T on `get_value_external` is not the type of wrapped object') + t.is( + e!.message, + 'T on `get_value_external` is not the type of wrapped object', + ) }) const AbortSignalTest = @@ -417,7 +420,7 @@ Napi4Test('throw error from thread safe function', async (t) => { threadsafeFunctionThrowError(reject) }) const err = await t.throwsAsync(throwPromise) - t.is(err.message, 'ThrowFromNative') + t.is(err!.message, 'ThrowFromNative') }) Napi4Test('resolve value from thread safe function fatal mode', async (t) => { diff --git a/examples/napi/__test__/values.spec.ts.snap b/examples/napi/__test__/values.spec.ts.snap index f5678bc022b544b559a2a65cf3a125e83ea7edba..0575b65e13861e73f2636728bcc12f78fb3381ae 100644 GIT binary patch literal 603 zcmV-h0;K&xRzV^AizzBE;d<4D%zkol$C2(9N z;|oghU$@&Ov`y$kLOYPCkO8d{TJO=psWVFDc4$>TlA3WPxi3PLVrsvXO3iF$^dtr= z80?pVtHEKYilL)YNE;Zj6W*w~z;F%2d!?`wR`E3E>X_@ChJ_V=n297Gq1!-rr*M_Y zxF0hSJ8xoQyGX2>L9_Pbs_}0xk^9o+Kr(wIkU#aYJ+mMB2}(-Cthrv`)QoPUX+z^I!Ty^94svnC800000000AR zlCf_SF%-t_TrWw}K$<3PX-jE}gqW;|1u+)!A0V-@I2Uud#<4B?E+PydA@L8e00RSK zB_;+2=86>wBs#INGNJCgHEHWd47I9LI@?JllNa=+&%sFc=OHA-v{6S zQZoO2SRo`JwZ%KF)0-dR`3X2%2!z}M9sxD3}#a z%c;Qd3Wm2zVJnQ}kT5S zsO5Q9(e34KWD}D@X_=_BpFddMG=9;*FLwU(h2ho-i_tZV27Jm