@mui/internal-test-utils 2.0.15 → 2.0.16

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.
Files changed (212) hide show
  1. package/{src/chai.types.ts → chai.types.d.ts} +7 -40
  2. package/chai.types.js +5 -0
  3. package/chaiPlugin.d.ts +4 -0
  4. package/chaiPlugin.js +287 -0
  5. package/{build/components.d.ts → components.d.ts} +18 -19
  6. package/components.js +64 -0
  7. package/createDOM.d.ts +2 -0
  8. package/{src/createDOM.js → createDOM.js} +17 -35
  9. package/createDescribe.d.ts +7 -0
  10. package/createDescribe.js +26 -0
  11. package/createRenderer.d.ts +214 -0
  12. package/createRenderer.js +428 -0
  13. package/createRenderer.test.d.ts +1 -0
  14. package/describeConformance.d.ts +200 -0
  15. package/describeConformance.js +1038 -0
  16. package/env.d.ts +1 -0
  17. package/env.js +11 -0
  18. package/esm/chai.types.d.ts +74 -0
  19. package/esm/chai.types.js +3 -0
  20. package/esm/chaiPlugin.d.ts +4 -0
  21. package/esm/chaiPlugin.js +281 -0
  22. package/esm/components.d.ts +35 -0
  23. package/esm/components.js +56 -0
  24. package/esm/createDOM.d.ts +2 -0
  25. package/esm/createDOM.js +47 -0
  26. package/esm/createDescribe.d.ts +7 -0
  27. package/esm/createDescribe.js +19 -0
  28. package/esm/createRenderer.d.ts +214 -0
  29. package/esm/createRenderer.js +390 -0
  30. package/esm/createRenderer.test.d.ts +1 -0
  31. package/esm/describeConformance.d.ts +200 -0
  32. package/esm/describeConformance.js +1024 -0
  33. package/esm/env.d.ts +1 -0
  34. package/esm/env.js +5 -0
  35. package/{build → esm}/fireDiscreteEvent.d.ts +1 -2
  36. package/{src/fireDiscreteEvent.ts → esm/fireDiscreteEvent.js} +10 -18
  37. package/esm/flushMicrotasks.d.ts +1 -0
  38. package/{src/flushMicrotasks.ts → esm/flushMicrotasks.js} +2 -3
  39. package/{build → esm}/focusVisible.d.ts +1 -2
  40. package/{src/focusVisible.ts → esm/focusVisible.js} +10 -9
  41. package/esm/index.d.ts +18 -0
  42. package/esm/index.js +27 -0
  43. package/esm/init.d.ts +1 -0
  44. package/{src → esm}/init.js +4 -2
  45. package/esm/initMatchers.d.ts +1 -0
  46. package/esm/initMatchers.js +6 -0
  47. package/esm/initMatchers.test.d.ts +1 -0
  48. package/esm/initPlaywrightMatchers.d.ts +24 -0
  49. package/esm/initPlaywrightMatchers.js +40 -0
  50. package/esm/package.json +1 -0
  51. package/esm/reactMajor.d.ts +2 -0
  52. package/esm/reactMajor.js +2 -0
  53. package/esm/setup.d.ts +1 -0
  54. package/{src → esm}/setup.js +2 -4
  55. package/esm/setupVitest.d.ts +1 -0
  56. package/esm/setupVitest.js +28 -0
  57. package/esm/setupVitestBrowser.d.ts +1 -0
  58. package/esm/setupVitestBrowser.js +30 -0
  59. package/fireDiscreteEvent.d.ts +6 -0
  60. package/fireDiscreteEvent.js +79 -0
  61. package/flushMicrotasks.d.ts +1 -0
  62. package/flushMicrotasks.js +10 -0
  63. package/focusVisible.d.ts +7 -0
  64. package/focusVisible.js +44 -0
  65. package/index.d.ts +18 -0
  66. package/index.js +139 -0
  67. package/init.d.ts +1 -0
  68. package/init.js +15 -0
  69. package/initMatchers.d.ts +1 -0
  70. package/initMatchers.js +10 -0
  71. package/initMatchers.test.d.ts +1 -0
  72. package/initPlaywrightMatchers.d.ts +24 -0
  73. package/initPlaywrightMatchers.js +42 -0
  74. package/package.json +89 -46
  75. package/reactMajor.d.ts +2 -0
  76. package/reactMajor.js +9 -0
  77. package/setup.d.ts +1 -0
  78. package/setup.js +10 -0
  79. package/setupVitest.d.ts +1 -0
  80. package/setupVitest.js +32 -0
  81. package/setupVitestBrowser.d.ts +1 -0
  82. package/setupVitestBrowser.js +34 -0
  83. package/build/.tsbuildinfo +0 -1
  84. package/build/KarmaReporterReactProfiler.d.ts +0 -51
  85. package/build/KarmaReporterReactProfiler.d.ts.map +0 -1
  86. package/build/KarmaReporterReactProfiler.js +0 -66
  87. package/build/KarmaReporterReactProfiler.js.map +0 -1
  88. package/build/chai.types.d.ts +0 -75
  89. package/build/chai.types.d.ts.map +0 -1
  90. package/build/chai.types.js +0 -3
  91. package/build/chai.types.js.map +0 -1
  92. package/build/chaiPlugin.d.ts +0 -5
  93. package/build/chaiPlugin.d.ts.map +0 -1
  94. package/build/chaiPlugin.js +0 -416
  95. package/build/chaiPlugin.js.map +0 -1
  96. package/build/components.d.ts.map +0 -1
  97. package/build/components.js +0 -88
  98. package/build/components.js.map +0 -1
  99. package/build/createDOM.d.ts +0 -3
  100. package/build/createDOM.d.ts.map +0 -1
  101. package/build/createDOM.js +0 -60
  102. package/build/createDOM.js.map +0 -1
  103. package/build/createDescribe.d.ts +0 -8
  104. package/build/createDescribe.d.ts.map +0 -1
  105. package/build/createDescribe.js +0 -22
  106. package/build/createDescribe.js.map +0 -1
  107. package/build/createRenderer.d.ts +0 -215
  108. package/build/createRenderer.d.ts.map +0 -1
  109. package/build/createRenderer.js +0 -564
  110. package/build/createRenderer.js.map +0 -1
  111. package/build/createRenderer.test.d.ts +0 -2
  112. package/build/createRenderer.test.d.ts.map +0 -1
  113. package/build/createRenderer.test.js +0 -58
  114. package/build/createRenderer.test.js.map +0 -1
  115. package/build/describeConformance.d.ts +0 -201
  116. package/build/describeConformance.d.ts.map +0 -1
  117. package/build/describeConformance.js +0 -859
  118. package/build/describeConformance.js.map +0 -1
  119. package/build/describeSkipIf.d.ts +0 -4
  120. package/build/describeSkipIf.d.ts.map +0 -1
  121. package/build/describeSkipIf.js +0 -10
  122. package/build/describeSkipIf.js.map +0 -1
  123. package/build/fireDiscreteEvent.d.ts.map +0 -1
  124. package/build/fireDiscreteEvent.js +0 -77
  125. package/build/fireDiscreteEvent.js.map +0 -1
  126. package/build/flushMicrotasks.d.ts +0 -2
  127. package/build/flushMicrotasks.d.ts.map +0 -1
  128. package/build/flushMicrotasks.js +0 -8
  129. package/build/flushMicrotasks.js.map +0 -1
  130. package/build/focusVisible.d.ts.map +0 -1
  131. package/build/focusVisible.js +0 -38
  132. package/build/focusVisible.js.map +0 -1
  133. package/build/index.d.ts +0 -18
  134. package/build/index.d.ts.map +0 -1
  135. package/build/index.js +0 -68
  136. package/build/index.js.map +0 -1
  137. package/build/init.d.ts +0 -2
  138. package/build/init.d.ts.map +0 -1
  139. package/build/init.js +0 -46
  140. package/build/init.js.map +0 -1
  141. package/build/initMatchers.d.ts +0 -2
  142. package/build/initMatchers.d.ts.map +0 -1
  143. package/build/initMatchers.js +0 -45
  144. package/build/initMatchers.js.map +0 -1
  145. package/build/initMatchers.test.d.ts +0 -2
  146. package/build/initMatchers.test.d.ts.map +0 -1
  147. package/build/initMatchers.test.js +0 -101
  148. package/build/initMatchers.test.js.map +0 -1
  149. package/build/initPlaywrightMatchers.d.ts +0 -25
  150. package/build/initPlaywrightMatchers.d.ts.map +0 -1
  151. package/build/initPlaywrightMatchers.js +0 -73
  152. package/build/initPlaywrightMatchers.js.map +0 -1
  153. package/build/mochaHooks.d.ts +0 -24
  154. package/build/mochaHooks.d.ts.map +0 -1
  155. package/build/mochaHooks.js +0 -165
  156. package/build/mochaHooks.js.map +0 -1
  157. package/build/mochaHooks.test.d.ts +0 -2
  158. package/build/mochaHooks.test.d.ts.map +0 -1
  159. package/build/mochaHooks.test.js +0 -128
  160. package/build/mochaHooks.test.js.map +0 -1
  161. package/build/reactMajor.d.ts +0 -3
  162. package/build/reactMajor.d.ts.map +0 -1
  163. package/build/reactMajor.js +0 -38
  164. package/build/reactMajor.js.map +0 -1
  165. package/build/setup.d.ts +0 -2
  166. package/build/setup.d.ts.map +0 -1
  167. package/build/setup.js +0 -10
  168. package/build/setup.js.map +0 -1
  169. package/build/setupBabel.d.ts +0 -2
  170. package/build/setupBabel.d.ts.map +0 -1
  171. package/build/setupBabel.js +0 -5
  172. package/build/setupBabel.js.map +0 -1
  173. package/build/setupBabelPlaywright.d.ts +0 -2
  174. package/build/setupBabelPlaywright.d.ts.map +0 -1
  175. package/build/setupBabelPlaywright.js +0 -14
  176. package/build/setupBabelPlaywright.js.map +0 -1
  177. package/build/setupJSDOM.d.ts +0 -7
  178. package/build/setupJSDOM.d.ts.map +0 -1
  179. package/build/setupJSDOM.js +0 -17
  180. package/build/setupJSDOM.js.map +0 -1
  181. package/build/setupKarma.d.ts +0 -2
  182. package/build/setupKarma.d.ts.map +0 -1
  183. package/build/setupKarma.js +0 -56
  184. package/build/setupKarma.js.map +0 -1
  185. package/build/setupVitest.d.ts +0 -2
  186. package/build/setupVitest.d.ts.map +0 -1
  187. package/build/setupVitest.js +0 -131
  188. package/build/setupVitest.js.map +0 -1
  189. package/src/KarmaReporterReactProfiler.js +0 -82
  190. package/src/chai-augmentation.d.ts +0 -8
  191. package/src/chaiPlugin.ts +0 -515
  192. package/src/components.tsx +0 -61
  193. package/src/createDOM.d.ts +0 -9
  194. package/src/createDescribe.ts +0 -31
  195. package/src/createRenderer.test.js +0 -31
  196. package/src/createRenderer.tsx +0 -808
  197. package/src/describeConformance.tsx +0 -1257
  198. package/src/describeSkipIf.tsx +0 -11
  199. package/src/index.ts +0 -25
  200. package/src/initMatchers.test.js +0 -124
  201. package/src/initMatchers.ts +0 -7
  202. package/src/initPlaywrightMatchers.ts +0 -101
  203. package/src/mochaHooks.js +0 -200
  204. package/src/mochaHooks.test.js +0 -116
  205. package/src/reactMajor.ts +0 -3
  206. package/src/setupBabel.js +0 -3
  207. package/src/setupBabelPlaywright.js +0 -13
  208. package/src/setupJSDOM.js +0 -20
  209. package/src/setupKarma.js +0 -65
  210. package/src/setupVitest.ts +0 -117
  211. package/tsconfig.build.json +0 -16
  212. package/tsconfig.json +0 -17
@@ -1,51 +0,0 @@
1
- declare namespace _exports {
2
- export { Browser };
3
- }
4
- declare const _exports: {
5
- 'reporter:profiler': (string | typeof KarmaReporterReactProfiler)[];
6
- };
7
- export = _exports;
8
- type Browser = {
9
- /**
10
- * - Seem random
11
- */
12
- id: string;
13
- /**
14
- * - Includes name, version and OS
15
- */
16
- name: string;
17
- };
18
- /**
19
- * @typedef {object} Browser
20
- * @property {string} id - Seem random
21
- * @property {string} name - Includes name, version and OS
22
- */
23
- /**
24
- * Records results from the Profiler injected
25
- * @param {*} karmaConfig
26
- */
27
- declare function KarmaReporterReactProfiler(karmaConfig: any): void;
28
- declare class KarmaReporterReactProfiler {
29
- /**
30
- * @typedef {object} Browser
31
- * @property {string} id - Seem random
32
- * @property {string} name - Includes name, version and OS
33
- */
34
- /**
35
- * Records results from the Profiler injected
36
- * @param {*} karmaConfig
37
- */
38
- constructor(karmaConfig: any);
39
- /**
40
- * @param {Browser} browser
41
- */
42
- onBrowserStart: (browser: Browser) => void;
43
- /**
44
- * @param {Browser} browser
45
- */
46
- onBrowserComplete: (browser: Browser) => void;
47
- }
48
- declare namespace KarmaReporterReactProfiler {
49
- let $inject: string[];
50
- }
51
- //# sourceMappingURL=KarmaReporterReactProfiler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KarmaReporterReactProfiler.d.ts","sourceRoot":"","sources":["../src/KarmaReporterReactProfiler.js"],"names":[],"mappings":";;;;;;;;;;;QAMc,MAAM;;;;UACN,MAAM;;AAHpB;;;;GAIG;AAEH;;;GAGG;AACH,yDAFW,GAAC,QA+DX;;IAvED;;;;OAIG;IAEH;;;OAGG;IACH,yBAFW,GAAC,EA+DX;IAnCC;;OAEG;IACH,0BAFW,OAAO,UAQjB;IAED;;OAEG;IACH,6BAFW,OAAO,UAsBjB"}
@@ -1,66 +0,0 @@
1
- "use strict";
2
- // File is not transpiled.
3
- const path = require('path');
4
- const fs = require('node:fs');
5
- /**
6
- * @typedef {object} Browser
7
- * @property {string} id - Seem random
8
- * @property {string} name - Includes name, version and OS
9
- */
10
- /**
11
- * Records results from the Profiler injected
12
- * @param {*} karmaConfig
13
- */
14
- function KarmaReporterReactProfiler(karmaConfig) {
15
- /**
16
- * Mapping from browser.id to all profiler results it received
17
- * @type {Map<string, Record<string, unknown[]>}
18
- */
19
- const allRenders = new Map();
20
- const { outputDir } = karmaConfig.reactProfilerReporter || {};
21
- if (typeof outputDir !== 'string') {
22
- throw new TypeError(`Expected karma config to contain reactProfilerReporter.outputDir of type 'string' but got type '${typeof outputDir}'.`);
23
- }
24
- fs.mkdirSync(outputDir, { recursive: true });
25
- /**
26
- * @param {Browser} browser
27
- * @param {unknown | { type: 'reactProfilerResults', detail: Record<string, unknown[]>}} info
28
- */
29
- function handleBrowserInfo(browser, info) {
30
- // `info?.type`
31
- if (info != null && info.type === 'reactProfilerResults') {
32
- Object.assign(allRenders.get(browser.id), info.detail);
33
- }
34
- }
35
- /**
36
- * @param {Browser} browser
37
- */
38
- this.onBrowserStart = (browser) => {
39
- allRenders.set(browser.id, {});
40
- // Create it on start to signal to users where the files will appear
41
- fs.mkdirSync(path.join(outputDir, browser.name), { recursive: true });
42
- browser.emitter.addListener('browser_info', handleBrowserInfo);
43
- };
44
- /**
45
- * @param {Browser} browser
46
- */
47
- this.onBrowserComplete = (browser) => {
48
- browser.emitter.removeListener('browser_info', handleBrowserInfo);
49
- const browserRenders = allRenders.get(browser.id);
50
- if (browserRenders === undefined) {
51
- // Can be undefined if the run for this browser never started.
52
- // For example, when starting the browser timed out in https://app.circleci.com/pipelines/github/mui/material-ui/32869/workflows/a2f398d9-2eb4-4390-a912-40c1b8d458d8/jobs/211413.
53
- console.warn(`Unable to find browser renders for '${browser.id}'. ` +
54
- `Only recorded renders for '${Array.from(allRenders.keys()).join("', '")}. ` +
55
- `Maybe the browser never started?'`);
56
- return;
57
- }
58
- fs.mkdirSync(path.join(outputDir, browser.name), { recursive: true });
59
- fs.writeFileSync(path.join(outputDir, browser.name, `${Date.now()}.json`), JSON.stringify(browserRenders, null, 2));
60
- };
61
- }
62
- KarmaReporterReactProfiler.$inject = ['config'];
63
- module.exports = {
64
- 'reporter:profiler': ['type', KarmaReporterReactProfiler],
65
- };
66
- //# sourceMappingURL=KarmaReporterReactProfiler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KarmaReporterReactProfiler.js","sourceRoot":"","sources":["../src/KarmaReporterReactProfiler.js"],"names":[],"mappings":";AAAA,0BAA0B;AAC1B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAE9B;;;;GAIG;AAEH;;;GAGG;AACH,SAAS,0BAA0B,CAAC,WAAW;IAC7C;;;OAGG;IACH,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;IAE7B,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,qBAAqB,IAAI,EAAE,CAAC;IAC9D,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CACjB,mGAAmG,OAAO,SAAS,IAAI,CACxH,CAAC;IACJ,CAAC;IACD,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7C;;;OAGG;IACH,SAAS,iBAAiB,CAAC,OAAO,EAAE,IAAI;QACtC,eAAe;QACf,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;YACzD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,cAAc,GAAG,CAAC,OAAO,EAAE,EAAE;QAChC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC/B,oEAAoE;QACpE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEtE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF;;OAEG;IACH,IAAI,CAAC,iBAAiB,GAAG,CAAC,OAAO,EAAE,EAAE;QACnC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;QAElE,MAAM,cAAc,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAClD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;YACjC,8DAA8D;YAC9D,kLAAkL;YAClL,OAAO,CAAC,IAAI,CACV,uCAAuC,OAAO,CAAC,EAAE,KAAK;gBACpD,8BAA8B,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;gBAC5E,mCAAmC,CACtC,CAAC;YACF,OAAO;QACT,CAAC;QAED,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,EAAE,CAAC,aAAa,CACd,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,EACxD,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CACxC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,0BAA0B,CAAC,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;AAEhD,MAAM,CAAC,OAAO,GAAG;IACf,mBAAmB,EAAE,CAAC,MAAM,EAAE,0BAA0B,CAAC;CAC1D,CAAC"}
@@ -1,75 +0,0 @@
1
- export {};
2
- declare global {
3
- namespace Chai {
4
- interface Assertion {
5
- /**
6
- * Checks `expectedStyle` is a subset of the elements inline style i.e. `element.style`.
7
- * @example expect(element).toHaveInlineStyle({ width: '200px' })
8
- */
9
- toHaveInlineStyle(expectedStyle: Partial<Record<Exclude<keyof CSSStyleDeclaration, 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty' | number>, string>>): void;
10
- /**
11
- * Checks `expectedStyle` is a subset of the elements computed style i.e. `window.getComputedStyle(element)`.
12
- * @example expect(element).toHaveComputedStyle({ width: '200px' })
13
- */
14
- toHaveComputedStyle(expectedStyle: Partial<Record<Exclude<keyof CSSStyleDeclaration, 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty' | number>, string>>): void;
15
- /**
16
- * Check if an element's [`visibility`](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility) is not `hidden` or `collapsed`.
17
- */
18
- toBeVisible(): void;
19
- /**
20
- * Check if an element's [`visibility`](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility) is `hidden` or `collapsed`.
21
- */
22
- toBeHidden(): void;
23
- /**
24
- * Checks if the element is inaccessible.
25
- *
26
- * Elements are considered inaccessible if they either:
27
- * - have [`visibility`](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility) `hidden`
28
- * - have [`display`](https://developer.mozilla.org/en-US/docs/Web/CSS/display) `none`
29
- * - have `aria-hidden` `true` or any of their parents
30
- *
31
- * @see [Excluding Elements from the Accessibility Tree](https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion)
32
- */
33
- toBeInaccessible(): void;
34
- toHaveAccessibleDescription(description: string): void;
35
- /**
36
- * Checks if the accessible name computation (according to `accname` spec)
37
- * matches the expectation.
38
- *
39
- * @see https://www.w3.org/TR/accname-1.2/
40
- * @param name
41
- */
42
- toHaveAccessibleName(name: string): void;
43
- /**
44
- * Checks if the element is actually focused i.e. `document.activeElement` is equal to the actual element.
45
- */
46
- toHaveFocus(): void;
47
- /**
48
- * Checks if the element is the active-descendant of the active element.
49
- */
50
- toHaveVirtualFocus(): void;
51
- /**
52
- * Matches calls to `console.warn` in the asserted callback.
53
- *
54
- * @example expect(() => render()).not.toWarnDev()
55
- * @example expect(() => render()).toWarnDev('single message')
56
- * @example expect(() => render()).toWarnDev(['first warning', 'then the second'])
57
- */
58
- toWarnDev(messages?: string | readonly (string | boolean)[]): void;
59
- /**
60
- * Matches calls to `console.error` in the asserted callback.
61
- *
62
- * @example expect(() => render()).not.toErrorDev()
63
- * @example expect(() => render()).toErrorDev('single message')
64
- * @example expect(() => render()).toErrorDev(['first warning', 'then the second'])
65
- */
66
- toErrorDev(messages?: string | readonly (string | boolean)[]): void;
67
- /**
68
- * Asserts that the given callback throws an error matching the given message in development (process.env.NODE_ENV !== 'production').
69
- * In production it expects a minified error.
70
- */
71
- toThrowMinified(message: string | RegExp): void;
72
- }
73
- }
74
- }
75
- //# sourceMappingURL=chai.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chai.types.d.ts","sourceRoot":"","sources":["../src/chai.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAGV,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,IAAI,CAAC;QACb,UAAU,SAAS;YACjB;;;eAGG;YACH,iBAAiB,CACf,aAAa,EAAE,OAAO,CACpB,MAAM,CACJ,OAAO,CACL,MAAM,mBAAmB,EACvB,qBAAqB,GACrB,kBAAkB,GAClB,MAAM,GACN,gBAAgB,GAChB,aAAa,GACb,MAAM,CACT,EACD,MAAM,CACP,CACF,GACA,IAAI,CAAC;YACR;;;eAGG;YACH,mBAAmB,CACjB,aAAa,EAAE,OAAO,CACpB,MAAM,CACJ,OAAO,CACL,MAAM,mBAAmB,EACvB,qBAAqB,GACrB,kBAAkB,GAClB,MAAM,GACN,gBAAgB,GAChB,aAAa,GACb,MAAM,CACT,EACD,MAAM,CACP,CACF,GACA,IAAI,CAAC;YACR;;eAEG;YACH,WAAW,IAAI,IAAI,CAAC;YACpB;;eAEG;YACH,UAAU,IAAI,IAAI,CAAC;YACnB;;;;;;;;;eASG;YACH,gBAAgB,IAAI,IAAI,CAAC;YACzB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;YACvD;;;;;;eAMG;YACH,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;YACzC;;eAEG;YACH,WAAW,IAAI,IAAI,CAAC;YACpB;;eAEG;YACH,kBAAkB,IAAI,IAAI,CAAC;YAC3B;;;;;;eAMG;YACH,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;YACnE;;;;;;eAMG;YACH,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;YACpE;;;eAGG;YACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;SACjD;KACF;CACF"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=chai.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chai.types.js","sourceRoot":"","sources":["../src/chai.types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- import * as chai from 'chai';
2
- import './chai.types';
3
- declare const chaiPlugin: Parameters<typeof chai.use>[0];
4
- export default chaiPlugin;
5
- //# sourceMappingURL=chaiPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chaiPlugin.d.ts","sourceRoot":"","sources":["../src/chaiPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAI7B,OAAO,cAAc,CAAC;AAgBtB,QAAA,MAAM,UAAU,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CA0e9C,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,416 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const dom_1 = require("@testing-library/dom");
40
- const pure_1 = require("@testing-library/react/pure");
41
- const chai = __importStar(require("chai"));
42
- const dom_accessibility_api_1 = require("dom-accessibility-api");
43
- const format_util_1 = __importDefault(require("format-util"));
44
- const string_1 = require("es-toolkit/string");
45
- require("./chai.types");
46
- const isKarma = Boolean(process.env.KARMA);
47
- function isInJSDOM() {
48
- return window.navigator.userAgent.includes('jsdom');
49
- }
50
- // chai#utils.elToString that looks like stringified elements in testing-library
51
- function elementToString(element) {
52
- if (typeof element?.nodeType === 'number') {
53
- return (0, pure_1.prettyDOM)(element, undefined, { highlight: !isKarma, maxDepth: 1 });
54
- }
55
- return String(element);
56
- }
57
- const chaiPlugin = (chaiAPI, utils) => {
58
- const blockElements = new Set([
59
- 'html',
60
- 'address',
61
- 'blockquote',
62
- 'body',
63
- 'dd',
64
- 'div',
65
- 'dl',
66
- 'dt',
67
- 'fieldset',
68
- 'form',
69
- 'frame',
70
- 'frameset',
71
- 'h1',
72
- 'h2',
73
- 'h3',
74
- 'h4',
75
- 'h5',
76
- 'h6',
77
- 'noframes',
78
- 'ol',
79
- 'p',
80
- 'ul',
81
- 'center',
82
- 'dir',
83
- 'hr',
84
- 'menu',
85
- 'pre',
86
- ]);
87
- function pretendVisibleGetComputedStyle(element) {
88
- // `CSSStyleDeclaration` is not constructable
89
- // https://stackoverflow.com/a/52732909/3406963
90
- // this is not equivalent to the declaration from `getComputedStyle`
91
- // for example `getComputedStyle` would return a readonly declaration
92
- // let's hope this doesn't get passed around until it's no longer clear where it comes from
93
- const declaration = document.createElement('span').style;
94
- // initial values
95
- declaration.content = '';
96
- // technically it's `inline`. We partially apply the default user agent sheet (chrome) here
97
- // we're only interested in elements that use block
98
- declaration.display = blockElements.has(element.tagName) ? 'block' : 'inline';
99
- declaration.visibility = 'visible';
100
- return declaration;
101
- }
102
- // better diff view for expect(element).to.equal(document.activeElement)
103
- chaiAPI.Assertion.addMethod('toHaveFocus', function elementIsFocused() {
104
- const element = utils.flag(this, 'object');
105
- this.assert(element === document.activeElement,
106
- // karma does not show the diff like mocha does
107
- `expected element to have focus${isKarma ? '\nexpected #{exp}\nactual: #{act}' : ''}`, `expected element to NOT have focus \n${elementToString(element)}`, elementToString(element), elementToString(document.activeElement));
108
- });
109
- chaiAPI.Assertion.addMethod('toHaveVirtualFocus', function elementIsVirtuallyFocused() {
110
- const element = utils.flag(this, 'object');
111
- const id = element.getAttribute('id');
112
- const virtuallyFocusedElementId = document.activeElement.getAttribute('aria-activedescendant');
113
- this.assert(virtuallyFocusedElementId === id, `expected element to be virtually focused\nexpected id #{exp}\n${virtuallyFocusedElementId === null
114
- ? `activeElement: ${elementToString(document.activeElement)}`
115
- : 'actual id: #{act}'}`, 'expected element to NOT to be virtually focused', id, virtuallyFocusedElementId, virtuallyFocusedElementId !== null);
116
- });
117
- chaiAPI.Assertion.addMethod('toBeInaccessible', function elementIsAccessible() {
118
- const element = utils.flag(this, 'object');
119
- const inaccessible = (0, dom_1.isInaccessible)(element);
120
- this.assert(inaccessible === true, `expected \n${elementToString(element)} to be inaccessible but it was accessible`, `expected \n${elementToString(element)} to be accessible but it was inaccessible`,
121
- // Not interested in a diff but the typings require the 4th parameter.
122
- undefined);
123
- });
124
- chaiAPI.Assertion.addMethod('toHaveAccessibleName', function hasAccessibleName(expectedName) {
125
- const root = utils.flag(this, 'object');
126
- // make sure it's an Element
127
- new chaiAPI.Assertion(root.nodeType, `Expected an Element but got '${String(root)}'`).to.equal(1);
128
- const actualName = (0, dom_accessibility_api_1.computeAccessibleName)(root, {
129
- computedStyleSupportsPseudoElements: !isInJSDOM(),
130
- // in local development we pretend to be visible. full getComputedStyle is
131
- // expensive and reserved for CI
132
- getComputedStyle: process.env.CI ? undefined : pretendVisibleGetComputedStyle,
133
- });
134
- this.assert(actualName === expectedName, `expected \n${elementToString(root)} to have accessible name #{exp} but got #{act} instead.`, `expected \n${elementToString(root)} not to have accessible name #{exp}.`, expectedName, actualName);
135
- });
136
- chaiAPI.Assertion.addMethod('toHaveAccessibleDescription', function hasAccessibleDescription(expectedDescription) {
137
- const root = utils.flag(this, 'object');
138
- // make sure it's an Element
139
- new chaiAPI.Assertion(root.nodeType, `Expected an Element but got '${String(root)}'`).to.equal(1);
140
- const actualDescription = (0, dom_accessibility_api_1.computeAccessibleDescription)(root, {
141
- // in local development we pretend to be visible. full getComputedStyle is
142
- // expensive and reserved for CI
143
- getComputedStyle: process.env.CI ? undefined : pretendVisibleGetComputedStyle,
144
- });
145
- const possibleDescriptionComputationMessage = root.hasAttribute('title')
146
- ? ' computeAccessibleDescription can be misleading when a `title` attribute is used. This might be a bug in `dom-accessibility-api`.'
147
- : '';
148
- this.assert(actualDescription === expectedDescription, `expected \n${elementToString(root)} to have accessible description #{exp} but got #{act} instead.${possibleDescriptionComputationMessage}`, `expected \n${elementToString(root)} not to have accessible description #{exp}.${possibleDescriptionComputationMessage}`, expectedDescription, actualDescription);
149
- });
150
- /**
151
- * Correct name for `to.be.visible`
152
- */
153
- chaiAPI.Assertion.addMethod('toBeVisible', function toBeVisible() {
154
- // eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-unused-expressions
155
- new chaiAPI.Assertion(this._obj).to.be.visible;
156
- });
157
- /**
158
- * Correct name for `not.to.be.visible`
159
- */
160
- chaiAPI.Assertion.addMethod('toBeHidden', function toBeHidden() {
161
- // eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-unused-expressions
162
- new chaiAPI.Assertion(this._obj).not.to.be.visible;
163
- });
164
- function assertMatchingStyles(actualStyleDeclaration, expectedStyleUnnormalized, options) {
165
- const { styleTypeHint } = options;
166
- // Compare objects using hyphen case.
167
- // This is closer to actual CSS and required for getPropertyValue anyway.
168
- const expectedStyle = {};
169
- Object.keys(expectedStyleUnnormalized).forEach((cssProperty) => {
170
- const hyphenCasedPropertyName = (0, string_1.kebabCase)(cssProperty);
171
- const isVendorPrefixed = /^(moz|ms|o|webkit)-/.test(hyphenCasedPropertyName);
172
- const propertyName = isVendorPrefixed
173
- ? `-${hyphenCasedPropertyName}`
174
- : hyphenCasedPropertyName;
175
- expectedStyle[propertyName] = expectedStyleUnnormalized[cssProperty];
176
- });
177
- const shorthandProperties = new Set([
178
- 'all',
179
- 'animation',
180
- 'background',
181
- 'border',
182
- 'border-block-end',
183
- 'border-block-start',
184
- 'border-bottom',
185
- 'border-color',
186
- 'border-image',
187
- 'border-inline-end',
188
- 'border-inline-start',
189
- 'border-left',
190
- 'border-radius',
191
- 'border-right',
192
- 'border-style',
193
- 'border-top',
194
- 'border-width',
195
- 'column-rule',
196
- 'columns',
197
- 'flex',
198
- 'flex-flow',
199
- 'font',
200
- 'gap',
201
- 'grid',
202
- 'grid-area',
203
- 'grid-column',
204
- 'grid-row',
205
- 'grid-template',
206
- 'list-style',
207
- 'margin',
208
- 'mask',
209
- 'offset',
210
- 'outline',
211
- 'overflow',
212
- 'padding',
213
- 'place-content',
214
- 'place-items',
215
- 'place-self',
216
- 'scroll-margin',
217
- 'scroll-padding',
218
- 'text-decoration',
219
- 'text-emphasis',
220
- 'transition',
221
- ]);
222
- const usedShorthandProperties = Object.keys(expectedStyle).filter((cssProperty) => {
223
- return shorthandProperties.has(cssProperty);
224
- });
225
- if (usedShorthandProperties.length > 0) {
226
- throw new Error([
227
- `Shorthand properties are not supported in ${styleTypeHint} styles matchers since browsers can compute them differently. `,
228
- 'Use longhand properties instead for the follow shorthand properties:\n',
229
- usedShorthandProperties
230
- .map((cssProperty) => {
231
- return `- https://developer.mozilla.org/en-US/docs/Web/CSS/${cssProperty}#constituent_properties`;
232
- })
233
- .join('\n'),
234
- ].join(''));
235
- }
236
- const actualStyle = {};
237
- Object.keys(expectedStyle).forEach((cssProperty) => {
238
- actualStyle[cssProperty] = actualStyleDeclaration.getPropertyValue(cssProperty);
239
- });
240
- const jsdomHint = 'Styles in JSDOM e.g. from `test:unit` are often misleading since JSDOM does not implement the Cascade nor actual CSS property value computation. ' +
241
- 'If results differ between real browsers and JSDOM, skip the test in JSDOM e.g. `if (window.navigator.userAgent.includes("jsdom")) this.skip();`';
242
- const shorthandHint = 'Browsers can compute shorthand properties differently. Prefer longhand properties e.g. `borderTopColor`, `borderRightColor` etc. instead of `border` or `border-color`.';
243
- const messageHint = `${jsdomHint}\n${shorthandHint}`;
244
- if (isKarma) {
245
- // `#{exp}` and `#{act}` placeholders escape the newlines
246
- const expected = JSON.stringify(expectedStyle, null, 2);
247
- const actual = JSON.stringify(actualStyle, null, 2);
248
- // karma's `dots` reporter does not support diffs
249
- this.assert(
250
- // TODO Fix upstream docs/types
251
- utils.eql(actualStyle, expectedStyle), `expected ${styleTypeHint} style of #{this} did not match\nExpected:\n${expected}\nActual:\n${actual}\n\n\n${messageHint}`, `expected #{this} to not have ${styleTypeHint} style\n${expected}\n\n\n${messageHint}`, expectedStyle, actualStyle);
252
- }
253
- else {
254
- this.assert(
255
- // TODO Fix upstream docs/types
256
- utils.eql(actualStyle, expectedStyle), `expected #{this} to have ${styleTypeHint} style #{exp} \n\n${messageHint}`, `expected #{this} not to have ${styleTypeHint} style #{exp}${messageHint}`, expectedStyle, actualStyle, true);
257
- }
258
- }
259
- chaiAPI.Assertion.addMethod('toHaveInlineStyle', function toHaveInlineStyle(expectedStyleUnnormalized) {
260
- const element = utils.flag(this, 'object');
261
- if (element?.nodeType !== 1) {
262
- // Same pre-condition for negated and unnegated assertion
263
- throw new chai.AssertionError(`Expected an Element but got ${String(element)}`);
264
- }
265
- assertMatchingStyles.call(this, element.style, expectedStyleUnnormalized, {
266
- styleTypeHint: 'inline',
267
- });
268
- });
269
- chaiAPI.Assertion.addMethod('toHaveComputedStyle', function toHaveComputedStyle(expectedStyleUnnormalized) {
270
- const element = utils.flag(this, 'object');
271
- if (element?.nodeType !== 1) {
272
- // Same pre-condition for negated and unnegated assertion
273
- throw new chai.AssertionError(`Expected an Element but got ${String(element)}`);
274
- }
275
- const computedStyle = element.ownerDocument.defaultView.getComputedStyle(element);
276
- assertMatchingStyles.call(this, computedStyle, expectedStyleUnnormalized, {
277
- styleTypeHint: 'computed',
278
- });
279
- });
280
- chaiAPI.Assertion.addMethod('toThrowMinified', function toThrowMinified(expectedDevMessage) {
281
- // TODO: Investigate if `as any` can be removed after https://github.com/DefinitelyTyped/DefinitelyTyped/issues/48634 is resolved.
282
- if (process.env.NODE_ENV !== 'production') {
283
- this.to.throw(expectedDevMessage);
284
- }
285
- else {
286
- utils.flag(this, 'message', "Looks like the error was not minified. This can happen if the error code hasn't been generated yet. Run `pnpm extract-error-codes` and try again.");
287
- // TODO: Investigate if `as any` can be removed after https://github.com/DefinitelyTyped/DefinitelyTyped/issues/48634 is resolved.
288
- this.to.throw('Minified MUI error', 'helper');
289
- }
290
- });
291
- function addConsoleMatcher(matcherName, methodName) {
292
- /**
293
- * @param {string[]} expectedMessages
294
- */
295
- function matcher(expectedMessagesInput = []) {
296
- // documented pattern to get the actual value of the assertion
297
- // eslint-disable-next-line no-underscore-dangle
298
- const callback = this._obj;
299
- if (process.env.NODE_ENV !== 'production') {
300
- const expectedMessages = typeof expectedMessagesInput === 'string'
301
- ? [expectedMessagesInput]
302
- : expectedMessagesInput.slice();
303
- const unexpectedMessages = [];
304
- // TODO Remove type once MUI X enables noImplicitAny
305
- let caughtError = null;
306
- this.assert(expectedMessages.length > 0, `Expected to call console.${methodName} but didn't provide messages. ` +
307
- `If you don't expect any messages prefer \`expect().not.${matcherName}();\`.`, `Expected no call to console.${methodName} while also expecting messages.` +
308
- 'Expected no call to console.error but provided messages. ' +
309
- "If you want to make sure a certain message isn't logged prefer the positive. " +
310
- 'By expecting certain messages you automatically expect that no other messages are logged',
311
- // Not interested in a diff but the typings require the 4th parameter.
312
- undefined);
313
- // Ignore skipped messages in e.g. `[condition && 'foo']`
314
- const remainingMessages = expectedMessages.filter((messageOrFalse) => {
315
- return messageOrFalse !== false;
316
- });
317
- // eslint-disable-next-line no-console
318
- const originalMethod = console[methodName];
319
- let messagesMatched = 0;
320
- const consoleMatcher = (format, ...args) => {
321
- // Ignore legacy root deprecation warnings
322
- // TODO: Remove once we no longer use legacy roots.
323
- if (format.includes('Use createRoot instead.') ||
324
- format.includes('Use hydrateRoot instead.')) {
325
- return;
326
- }
327
- const actualMessage = (0, format_util_1.default)(format, ...args);
328
- const expectedMessage = remainingMessages.shift();
329
- messagesMatched += 1;
330
- // TODO Remove type once MUI X enables noImplicitAny
331
- let message = null;
332
- if (expectedMessage === undefined) {
333
- message = `Expected no more error messages but got:\n"${actualMessage}"`;
334
- }
335
- else if (!actualMessage.includes(expectedMessage)) {
336
- message = `Expected #${messagesMatched} "${expectedMessage}" to be included in \n"${actualMessage}"`;
337
- }
338
- if (message !== null) {
339
- const error = new Error(message);
340
- const { stack: fullStack } = error;
341
- const fullStacktrace = fullStack.replace(`Error: ${message}\n`, '').split('\n');
342
- const usefulStacktrace = fullStacktrace
343
- //
344
- // first line points to this frame which is irrelevant for the tester
345
- .slice(1);
346
- const usefulStack = `${message}\n${usefulStacktrace.join('\n')}`;
347
- error.stack = usefulStack;
348
- unexpectedMessages.push(error);
349
- }
350
- };
351
- // eslint-disable-next-line no-console
352
- console[methodName] = consoleMatcher;
353
- try {
354
- callback();
355
- }
356
- catch (error) {
357
- caughtError = error;
358
- }
359
- finally {
360
- // eslint-disable-next-line no-console
361
- console[methodName] = originalMethod;
362
- // unexpected thrown error takes precedence over unexpected console call
363
- if (caughtError !== null) {
364
- // not the same pattern as described in the block because we don't rethrow in the catch
365
- // eslint-disable-next-line no-unsafe-finally
366
- throw caughtError;
367
- }
368
- const formatMessages = (messages) => {
369
- const formattedMessages = messages.map((message) => {
370
- if (typeof message === 'string') {
371
- return `"${message}"`;
372
- }
373
- // full Error
374
- return `${message.stack}`;
375
- });
376
- return `\n\n - ${formattedMessages.join('\n\n- ')}`;
377
- };
378
- const shouldHaveWarned = utils.flag(this, 'negate') !== true;
379
- // unreachable from expect().not.toWarnDev(messages)
380
- if (unexpectedMessages.length > 0) {
381
- const unexpectedMessageRecordedMessage = `Recorded unexpected console.${methodName} calls: ${formatMessages(unexpectedMessages)}`;
382
- // chai will duplicate the stack frames from the unexpected calls in their assertion error
383
- // it's not ideal but the test failure is located the second to last stack frame
384
- // and the origin of the call is the second stackframe in the stack
385
- this.assert(
386
- // force chai to always trigger an assertion error
387
- !shouldHaveWarned, unexpectedMessageRecordedMessage, unexpectedMessageRecordedMessage,
388
- // Not interested in a diff but the typings require the 4th parameter.
389
- undefined);
390
- }
391
- if (shouldHaveWarned) {
392
- this.assert(remainingMessages.length === 0, `Could not match the following console.${methodName} calls. ` +
393
- `Make sure previous actions didn't call console.${methodName} by wrapping them in expect(() => {}).not.${matcherName}(): ${formatMessages(remainingMessages)}`, `Impossible state reached in \`expect().${matcherName}()\`. ` +
394
- `This is a bug in the matcher.`,
395
- // Not interested in a diff but the typings require the 4th parameter.
396
- undefined);
397
- }
398
- }
399
- }
400
- else {
401
- // nothing to do in prod
402
- // If there are still console calls than our test setup throws.
403
- callback();
404
- }
405
- }
406
- chaiAPI.Assertion.addMethod(matcherName, matcher);
407
- }
408
- /**
409
- * @example expect(() => render()).toWarnDev('single message')
410
- * @example expect(() => render()).toWarnDev(['first warning', 'then the second'])
411
- */
412
- addConsoleMatcher('toWarnDev', 'warn');
413
- addConsoleMatcher('toErrorDev', 'error');
414
- };
415
- exports.default = chaiPlugin;
416
- //# sourceMappingURL=chaiPlugin.js.map