@wordpress/jest-console 5.1.0-next.e230fbab09.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.1.0 (2022-05-18)
6
+
7
+ ### Enhancements
8
+
9
+ - Added TypeScript definitions for package consumers ([#40957](https://github.com/WordPress/gutenberg/pull/40957)).
10
+
5
11
  ## 5.0.0 (2022-01-27)
6
12
 
7
13
  ### Breaking Changes
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","printReceived","assertionsNumber","createToHaveBeenCalledWith","expected","objects","expect","extend","supportedMatchers","result","matcherNameWith"],"mappings":";;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,6BAA6B,GAAG,CAAEC,WAAF,EAAeC,UAAf,KACrCC,QADoE,IAEhE;AACJ,QAAMC,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAGF,KAAK,CAACG,MAAN,GAAe,CAA5B;AACA,QAAMC,OAAO,GAAGF,IAAI,GACjB,MACA,mCAAc,OAAON,WAAa,EAAlC,EAAqCG,GAAG,CAACM,WAAJ,EAArC,IACA,MADA,GAEA,mEAFA,GAGAL,KAAK,CAACM,GAAN,CAAWC,+BAAX,CALiB,GAMjB,MACA,mCAAaX,WAAb,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,IACA,MADA,GAEA,sCATH;AAWAN,EAAAA,GAAG,CAACS,gBAAJ,IAAwB,CAAxB;AAEA,SAAO;AACNJ,IAAAA,OADM;AAENF,IAAAA;AAFM,GAAP;AAIA,CAvBD;;AAyBA,MAAMO,0BAA0B,GAAG,CAAEb,WAAF,EAAeC,UAAf,KAA+B,UACjEC,QADiE,EAG7D;AAAA,oCADDY,QACC;AADDA,IAAAA,QACC;AAAA;;AACJ,QAAMX,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAG,kBAAMF,KAAN,EAAeW,OAAF,IAAe,qBAASA,OAAT,EAAkBD,QAAlB,CAA5B,CAAb;AACA,QAAMN,OAAO,GAAGF,IAAI,GACjB,MACA,mCAAc,OAAON,WAAa,EAAlC,EAAqCG,GAAG,CAACM,WAAJ,EAArC,IACA,MADA,GAEA,iDAFA,GAGA,qCAAeK,QAAf,CALiB,GAMjB,MACA,mCAAad,WAAb,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,IACA,MADA,GAEA,6CAFA,GAGA,qCAAeK,QAAf,CAHA,GAIA,IAJA,GAKA,2BALA,GAMAV,KAAK,CAACM,GAAN,CAAWC,+BAAX,CAbH;AAeAR,EAAAA,GAAG,CAACS,gBAAJ,IAAwB,CAAxB;AAEA,SAAO;AACNJ,IAAAA,OADM;AAENF,IAAAA;AAFM,GAAP;AAIA,CA5BD;;AA8BAU,MAAM,CAACC,MAAP,CACC,oBACCC,0BADD,EAEC,CAAEC,MAAF,EAAUnB,WAAV,EAAuBC,UAAvB,KAAuC;AACtC,QAAMmB,eAAe,GAAI,GAAGpB,WAAa,MAAzC;AAEA,SAAO,EACN,GAAGmB,MADG;AAEN,KAAEnB,WAAF,GAAiBD,6BAA6B,CAC5C,IAAIC,WAAa,EAD2B,EAE7CC,UAF6C,CAFxC;AAMN,KAAEmB,eAAF,GAAqBP,0BAA0B,CAC7C,IAAIO,eAAiB,EADwB,EAE9CnB,UAF8C;AANzC,GAAP;AAWA,CAhBF,EAiBC,EAjBD,CADD","sourcesContent":["/**\n * External dependencies\n */\nimport { matcherHint, printExpected, printReceived } from 'jest-matcher-utils';\nimport { isEqual, reduce, some } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport supportedMatchers from './supported-matchers';\n\nconst createToHaveBeenCalledMatcher = ( matcherName, methodName ) => (\n\treceived\n) => {\n\tconst spy = received[ methodName ];\n\tconst calls = spy.mock.calls;\n\tconst pass = calls.length > 0;\n\tconst message = pass\n\t\t? () =>\n\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function not to be called but it was called with:\\n' +\n\t\t\t\tcalls.map( printReceived )\n\t\t: () =>\n\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function to be called.';\n\n\tspy.assertionsNumber += 1;\n\n\treturn {\n\t\tmessage,\n\t\tpass,\n\t};\n};\n\nconst createToHaveBeenCalledWith = ( matcherName, methodName ) => (\n\treceived,\n\t...expected\n) => {\n\tconst spy = received[ methodName ];\n\tconst calls = spy.mock.calls;\n\tconst pass = some( calls, ( objects ) => isEqual( objects, expected ) );\n\tconst message = pass\n\t\t? () =>\n\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function not to be called with:\\n' +\n\t\t\t\tprintExpected( expected )\n\t\t: () =>\n\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function to be called with:\\n' +\n\t\t\t\tprintExpected( expected ) +\n\t\t\t\t'\\n' +\n\t\t\t\t'but it was called with:\\n' +\n\t\t\t\tcalls.map( printReceived );\n\n\tspy.assertionsNumber += 1;\n\n\treturn {\n\t\tmessage,\n\t\tpass,\n\t};\n};\n\nexpect.extend(\n\treduce(\n\t\tsupportedMatchers,\n\t\t( result, matcherName, methodName ) => {\n\t\t\tconst matcherNameWith = `${ matcherName }With`;\n\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\t[ matcherName ]: createToHaveBeenCalledMatcher(\n\t\t\t\t\t`.${ matcherName }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t\t[ matcherNameWith ]: createToHaveBeenCalledWith(\n\t\t\t\t\t`.${ matcherNameWith }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t{}\n\t)\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","printReceived","assertionsNumber","createToHaveBeenCalledWith","expected","objects","expect","extend","supportedMatchers","result","matcherNameWith"],"mappings":";;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,6BAA6B,GAClC,CAAEC,WAAF,EAAeC,UAAf,KAAiCC,QAAF,IAAgB;AAC9C,QAAMC,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAGF,KAAK,CAACG,MAAN,GAAe,CAA5B;AACA,QAAMC,OAAO,GAAGF,IAAI,GACjB,MACA,mCAAc,OAAON,WAAa,EAAlC,EAAqCG,GAAG,CAACM,WAAJ,EAArC,IACA,MADA,GAEA,mEAFA,GAGAL,KAAK,CAACM,GAAN,CAAWC,+BAAX,CALiB,GAMjB,MACA,mCAAaX,WAAb,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,IACA,MADA,GAEA,sCATH;AAWAN,EAAAA,GAAG,CAACS,gBAAJ,IAAwB,CAAxB;AAEA,SAAO;AACNJ,IAAAA,OADM;AAENF,IAAAA;AAFM,GAAP;AAIA,CAtBF;;AAwBA,MAAMO,0BAA0B,GAC/B,CAAEb,WAAF,EAAeC,UAAf,KACA,UAAEC,QAAF,EAA6B;AAAA,oCAAdY,QAAc;AAAdA,IAAAA,QAAc;AAAA;;AAC5B,QAAMX,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAG,kBAAMF,KAAN,EAAeW,OAAF,IAAe,qBAASA,OAAT,EAAkBD,QAAlB,CAA5B,CAAb;AACA,QAAMN,OAAO,GAAGF,IAAI,GACjB,MACA,mCAAc,OAAON,WAAa,EAAlC,EAAqCG,GAAG,CAACM,WAAJ,EAArC,IACA,MADA,GAEA,iDAFA,GAGA,qCAAeK,QAAf,CALiB,GAMjB,MACA,mCAAad,WAAb,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,IACA,MADA,GAEA,6CAFA,GAGA,qCAAeK,QAAf,CAHA,GAIA,IAJA,GAKA,2BALA,GAMAV,KAAK,CAACM,GAAN,CAAWC,+BAAX,CAbH;AAeAR,EAAAA,GAAG,CAACS,gBAAJ,IAAwB,CAAxB;AAEA,SAAO;AACNJ,IAAAA,OADM;AAENF,IAAAA;AAFM,GAAP;AAIA,CA3BF;;AA6BAU,MAAM,CAACC,MAAP,CACC,oBACCC,0BADD,EAEC,CAAEC,MAAF,EAAUnB,WAAV,EAAuBC,UAAvB,KAAuC;AACtC,QAAMmB,eAAe,GAAI,GAAGpB,WAAa,MAAzC;AAEA,SAAO,EACN,GAAGmB,MADG;AAEN,KAAEnB,WAAF,GAAiBD,6BAA6B,CAC5C,IAAIC,WAAa,EAD2B,EAE7CC,UAF6C,CAFxC;AAMN,KAAEmB,eAAF,GAAqBP,0BAA0B,CAC7C,IAAIO,eAAiB,EADwB,EAE9CnB,UAF8C;AANzC,GAAP;AAWA,CAhBF,EAiBC,EAjBD,CADD","sourcesContent":["/**\n * External dependencies\n */\nimport { matcherHint, printExpected, printReceived } from 'jest-matcher-utils';\nimport { isEqual, reduce, some } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport supportedMatchers from './supported-matchers';\n\nconst createToHaveBeenCalledMatcher =\n\t( matcherName, methodName ) => ( received ) => {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = calls.length > 0;\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called.';\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nconst createToHaveBeenCalledWith =\n\t( matcherName, methodName ) =>\n\t( received, ...expected ) => {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = some( calls, ( objects ) => isEqual( objects, expected ) );\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected ) +\n\t\t\t\t\t'\\n' +\n\t\t\t\t\t'but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived );\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nexpect.extend(\n\treduce(\n\t\tsupportedMatchers,\n\t\t( result, matcherName, methodName ) => {\n\t\t\tconst matcherNameWith = `${ matcherName }With`;\n\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\t[ matcherName ]: createToHaveBeenCalledMatcher(\n\t\t\t\t\t`.${ matcherName }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t\t[ matcherNameWith ]: createToHaveBeenCalledWith(\n\t\t\t\t\t`.${ matcherNameWith }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t{}\n\t)\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["matcherHint","printExpected","printReceived","isEqual","reduce","some","supportedMatchers","createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","assertionsNumber","createToHaveBeenCalledWith","expected","objects","expect","extend","result","matcherNameWith"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,aAAtB,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,OAAT,EAAkBC,MAAlB,EAA0BC,IAA1B,QAAsC,QAAtC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;;AAEA,MAAMC,6BAA6B,GAAG,CAAEC,WAAF,EAAeC,UAAf,KACrCC,QADoE,IAEhE;AACJ,QAAMC,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAGF,KAAK,CAACG,MAAN,GAAe,CAA5B;AACA,QAAMC,OAAO,GAAGF,IAAI,GACjB,MACAd,WAAW,CAAG,OAAOQ,WAAa,EAAvB,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,CAAX,GACA,MADA,GAEA,mEAFA,GAGAL,KAAK,CAACM,GAAN,CAAWhB,aAAX,CALiB,GAMjB,MACAF,WAAW,CAAEQ,WAAF,EAAeG,GAAG,CAACM,WAAJ,EAAf,CAAX,GACA,MADA,GAEA,sCATH;AAWAN,EAAAA,GAAG,CAACQ,gBAAJ,IAAwB,CAAxB;AAE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IM,eAAiB,EADwB,EAE9CjB,UAF8C;AANzC,GAAP;AAWA,CAhBI,EAiBL,EAjBK,CADP","sourcesContent":["/**\n * External dependencies\n */\nimport { matcherHint, printExpected, printReceived } from 'jest-matcher-utils';\nimport { isEqual, reduce, some } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport supportedMatchers from './supported-matchers';\n\nconst createToHaveBeenCalledMatcher = ( matcherName, methodName ) => (\n\treceived\n) => {\n\tconst spy = received[ methodName ];\n\tconst calls = spy.mock.calls;\n\tconst pass = calls.length > 0;\n\tconst message = pass\n\t\t? () =>\n\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function not to be called but it was called with:\\n' +\n\t\t\t\tcalls.map( printReceived )\n\t\t: () =>\n\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function to be called.';\n\n\tspy.assertionsNumber += 1;\n\n\treturn {\n\t\tmessage,\n\t\tpass,\n\t};\n};\n\nconst createToHaveBeenCalledWith = ( matcherName, methodName ) => (\n\treceived,\n\t...expected\n) => {\n\tconst spy = received[ methodName ];\n\tconst calls = spy.mock.calls;\n\tconst pass = some( calls, ( objects ) => isEqual( objects, expected ) );\n\tconst message = pass\n\t\t? () =>\n\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function not to be called with:\\n' +\n\t\t\t\tprintExpected( expected )\n\t\t: () =>\n\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t'\\n\\n' +\n\t\t\t\t'Expected mock function to be called with:\\n' +\n\t\t\t\tprintExpected( expected ) +\n\t\t\t\t'\\n' +\n\t\t\t\t'but it was called with:\\n' +\n\t\t\t\tcalls.map( printReceived );\n\n\tspy.assertionsNumber += 1;\n\n\treturn {\n\t\tmessage,\n\t\tpass,\n\t};\n};\n\nexpect.extend(\n\treduce(\n\t\tsupportedMatchers,\n\t\t( result, matcherName, methodName ) => {\n\t\t\tconst matcherNameWith = `${ matcherName }With`;\n\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\t[ matcherName ]: createToHaveBeenCalledMatcher(\n\t\t\t\t\t`.${ matcherName }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t\t[ matcherNameWith ]: createToHaveBeenCalledWith(\n\t\t\t\t\t`.${ matcherNameWith }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t{}\n\t)\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/jest-console/src/matchers.js"],"names":["matcherHint","printExpected","printReceived","isEqual","reduce","some","supportedMatchers","createToHaveBeenCalledMatcher","matcherName","methodName","received","spy","calls","mock","pass","length","message","getMockName","map","assertionsNumber","createToHaveBeenCalledWith","expected","objects","expect","extend","result","matcherNameWith"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,aAAtB,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,OAAT,EAAkBC,MAAlB,EAA0BC,IAA1B,QAAsC,QAAtC;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;;AAEA,MAAMC,6BAA6B,GAClC,CAAEC,WAAF,EAAeC,UAAf,KAAiCC,QAAF,IAAgB;AAC9C,QAAMC,GAAG,GAAGD,QAAQ,CAAED,UAAF,CAApB;AACA,QAAMG,KAAK,GAAGD,GAAG,CAACE,IAAJ,CAASD,KAAvB;AACA,QAAME,IAAI,GAAGF,KAAK,CAACG,MAAN,GAAe,CAA5B;AACA,QAAMC,OAAO,GAAGF,IAAI,GACjB,MACAd,WAAW,CAAG,OAAOQ,WAAa,EAAvB,EAA0BG,GAAG,CAACM,WAAJ,EAA1B,CAAX,GACA,MADA,GAEA,mEAFA,GAGAL,KAAK,CAACM,GAAN,CAAWhB,aAAX,CALiB,GAMjB,MACA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,MADG;AAEN,KAAEjB,WAAF,GAAiBD,6BAA6B,CAC5C,IAAIC,WAAa,EAD2B,EAE7CC,UAF6C,CAFxC;AAMN,KAAEiB,eAAF,GAAqBN,0BAA0B,CAC7C,IAAIM,eAAiB,EADwB,EAE9CjB,UAF8C;AANzC,GAAP;AAWA,CAhBI,EAiBL,EAjBK,CADP","sourcesContent":["/**\n * External dependencies\n */\nimport { matcherHint, printExpected, printReceived } from 'jest-matcher-utils';\nimport { isEqual, reduce, some } from 'lodash';\n\n/**\n * Internal dependencies\n */\nimport supportedMatchers from './supported-matchers';\n\nconst createToHaveBeenCalledMatcher =\n\t( matcherName, methodName ) => ( received ) => {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = calls.length > 0;\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called.';\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nconst createToHaveBeenCalledWith =\n\t( matcherName, methodName ) =>\n\t( received, ...expected ) => {\n\t\tconst spy = received[ methodName ];\n\t\tconst calls = spy.mock.calls;\n\t\tconst pass = some( calls, ( objects ) => isEqual( objects, expected ) );\n\t\tconst message = pass\n\t\t\t? () =>\n\t\t\t\t\tmatcherHint( `.not${ matcherName }`, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function not to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected )\n\t\t\t: () =>\n\t\t\t\t\tmatcherHint( matcherName, spy.getMockName() ) +\n\t\t\t\t\t'\\n\\n' +\n\t\t\t\t\t'Expected mock function to be called with:\\n' +\n\t\t\t\t\tprintExpected( expected ) +\n\t\t\t\t\t'\\n' +\n\t\t\t\t\t'but it was called with:\\n' +\n\t\t\t\t\tcalls.map( printReceived );\n\n\t\tspy.assertionsNumber += 1;\n\n\t\treturn {\n\t\t\tmessage,\n\t\t\tpass,\n\t\t};\n\t};\n\nexpect.extend(\n\treduce(\n\t\tsupportedMatchers,\n\t\t( result, matcherName, methodName ) => {\n\t\t\tconst matcherNameWith = `${ matcherName }With`;\n\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\t[ matcherName ]: createToHaveBeenCalledMatcher(\n\t\t\t\t\t`.${ matcherName }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t\t[ matcherNameWith ]: createToHaveBeenCalledWith(\n\t\t\t\t\t`.${ matcherNameWith }`,\n\t\t\t\t\tmethodName\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t{}\n\t)\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/jest-console",
3
- "version": "5.1.0-next.e230fbab09.0",
3
+ "version": "5.3.0",
4
4
  "description": "Custom Jest matchers for the Console object.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -25,10 +25,12 @@
25
25
  },
26
26
  "files": [
27
27
  "build",
28
- "build-module"
28
+ "build-module",
29
+ "types"
29
30
  ],
30
31
  "main": "build/index.js",
31
32
  "module": "build-module/index.js",
33
+ "types": "types",
32
34
  "dependencies": {
33
35
  "@babel/runtime": "^7.16.0",
34
36
  "jest-matcher-utils": "^27.4.2",
@@ -40,5 +42,5 @@
40
42
  "publishConfig": {
41
43
  "access": "public"
42
44
  },
43
- "gitHead": "308df03e6a96ded732f9c4e32471b1b4f8dea54a"
45
+ "gitHead": "48d5f37dfb52d2e77c8eeb662f9874cf141b8c6b"
44
46
  }
@@ -0,0 +1,46 @@
1
+ // Definitions originally written by Damien Sorel <https://github.com/mistic100> under MIT license.
2
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f0b72c12f6b561e4342dc8a1cf87432d2ad40ae7/types/wordpress__jest-console/index.d.ts
3
+
4
+ declare namespace jest {
5
+ interface Matchers< R, T > {
6
+ /**
7
+ * Ensure that `console.error` function was called.
8
+ */
9
+ toHaveErrored(): R;
10
+
11
+ /**
12
+ * Ensure that `console.error` function was called with specific arguments.
13
+ */
14
+ toHaveErroredWith( ...args: any[] ): R;
15
+
16
+ /**
17
+ * Ensure that `console.info` function was called.
18
+ */
19
+ toHaveInformed(): R;
20
+
21
+ /**
22
+ * Ensure that `console.info` function was called with specific arguments.
23
+ */
24
+ toHaveInformedWith( ...args: any[] ): R;
25
+
26
+ /**
27
+ * Ensure that `console.log` function was called.
28
+ */
29
+ toHaveLogged(): R;
30
+
31
+ /**
32
+ * Ensure that `console.log` function was called with specific arguments.
33
+ */
34
+ toHaveLoggedWith( ...args: any[] ): R;
35
+
36
+ /**
37
+ * Ensure that `console.warn` function was called.
38
+ */
39
+ toHaveWarned(): R;
40
+
41
+ /**
42
+ * Ensure that `console.warn` function was called with specific arguments.
43
+ */
44
+ toHaveWarnedWith( ...args: any[] ): R;
45
+ }
46
+ }