@pezkuwi/dev-test 0.85.1 → 0.85.3

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 (127) hide show
  1. package/.skip-deno +0 -0
  2. package/package.json +9 -199
  3. package/tsconfig.build.json +16 -0
  4. package/tsconfig.build.tsbuildinfo +1 -0
  5. package/tsconfig.spec.json +16 -0
  6. package/tsconfig.spec.tsbuildinfo +1 -0
  7. package/LICENSE +0 -201
  8. package/browser.d.ts +0 -1
  9. package/browser.js +0 -2
  10. package/cjs/browser.d.ts +0 -1
  11. package/cjs/browser.js +0 -4
  12. package/cjs/detectOther.d.ts +0 -2
  13. package/cjs/detectOther.js +0 -3
  14. package/cjs/env/browser.d.ts +0 -313
  15. package/cjs/env/browser.js +0 -98
  16. package/cjs/env/expect.d.ts +0 -297
  17. package/cjs/env/expect.js +0 -213
  18. package/cjs/env/index.d.ts +0 -4
  19. package/cjs/env/index.js +0 -20
  20. package/cjs/env/jest.d.ts +0 -127
  21. package/cjs/env/jest.js +0 -56
  22. package/cjs/env/lifecycle.d.ts +0 -12
  23. package/cjs/env/lifecycle.js +0 -17
  24. package/cjs/env/suite.d.ts +0 -16
  25. package/cjs/env/suite.js +0 -35
  26. package/cjs/index.d.ts +0 -1
  27. package/cjs/index.js +0 -1
  28. package/cjs/node.d.ts +0 -1
  29. package/cjs/node.js +0 -4
  30. package/cjs/package.json +0 -3
  31. package/cjs/packageInfo.d.ts +0 -6
  32. package/cjs/packageInfo.js +0 -4
  33. package/cjs/root.d.ts +0 -2
  34. package/cjs/root.js +0 -6
  35. package/cjs/rootJs/Clazz.d.ts +0 -18
  36. package/cjs/rootJs/Clazz.js +0 -36
  37. package/cjs/rootJs/Jsx.d.ts +0 -5
  38. package/cjs/rootJs/Jsx.js +0 -16
  39. package/cjs/rootJs/JsxChild.d.ts +0 -9
  40. package/cjs/rootJs/JsxChild.js +0 -9
  41. package/cjs/rootJs/augmented.d.ts +0 -8
  42. package/cjs/rootJs/augmented.js +0 -3
  43. package/cjs/rootJs/index.d.ts +0 -19
  44. package/cjs/rootJs/index.js +0 -51
  45. package/cjs/rootTests.d.ts +0 -2
  46. package/cjs/rootTests.js +0 -44
  47. package/cjs/sample.d.ts +0 -1
  48. package/cjs/sample.js +0 -4
  49. package/cjs/types.d.ts +0 -15
  50. package/cjs/types.js +0 -2
  51. package/cjs/util.d.ts +0 -20
  52. package/cjs/util.js +0 -51
  53. package/config/eslint.js +0 -160
  54. package/config/eslint.rules.js +0 -214
  55. package/config/prettier.cjs +0 -22
  56. package/config/rollup.js +0 -113
  57. package/config/tsconfig.json +0 -32
  58. package/config/typedoc.cjs +0 -18
  59. package/detectOther.d.ts +0 -2
  60. package/detectOther.js +0 -1
  61. package/env/browser.d.ts +0 -313
  62. package/env/browser.js +0 -95
  63. package/env/expect.d.ts +0 -297
  64. package/env/expect.js +0 -210
  65. package/env/index.d.ts +0 -4
  66. package/env/index.js +0 -17
  67. package/env/jest.d.ts +0 -127
  68. package/env/jest.js +0 -53
  69. package/env/lifecycle.d.ts +0 -12
  70. package/env/lifecycle.js +0 -14
  71. package/env/suite.d.ts +0 -16
  72. package/env/suite.js +0 -32
  73. package/globals.cjs +0 -4
  74. package/globals.d.cts +0 -1
  75. package/globals.d.ts +0 -32
  76. package/index.d.ts +0 -1
  77. package/index.js +0 -1
  78. package/node.d.ts +0 -1
  79. package/node.js +0 -2
  80. package/packageInfo.d.ts +0 -6
  81. package/packageInfo.js +0 -1
  82. package/root.d.ts +0 -2
  83. package/root.js +0 -2
  84. package/rootJs/Clazz.d.ts +0 -18
  85. package/rootJs/Clazz.js +0 -32
  86. package/rootJs/Jsx.d.ts +0 -5
  87. package/rootJs/Jsx.js +0 -13
  88. package/rootJs/JsxChild.d.ts +0 -9
  89. package/rootJs/JsxChild.js +0 -6
  90. package/rootJs/augmented.d.ts +0 -8
  91. package/rootJs/augmented.js +0 -2
  92. package/rootJs/dynamic.d.mts +0 -8
  93. package/rootJs/dynamic.mjs +0 -13
  94. package/rootJs/index.d.ts +0 -19
  95. package/rootJs/index.js +0 -39
  96. package/rootJs/testJson.json +0 -5
  97. package/rootStatic/zagros.svg +0 -1
  98. package/rootTests.d.ts +0 -2
  99. package/rootTests.js +0 -41
  100. package/scripts/pezkuwi-ci-ghact-build.mjs +0 -536
  101. package/scripts/pezkuwi-ci-ghact-docs.mjs +0 -14
  102. package/scripts/pezkuwi-ci-ghpages-force.mjs +0 -43
  103. package/scripts/pezkuwi-dev-build-docs.mjs +0 -19
  104. package/scripts/pezkuwi-dev-build-ts.mjs +0 -1518
  105. package/scripts/pezkuwi-dev-circular.mjs +0 -29
  106. package/scripts/pezkuwi-dev-clean-build.mjs +0 -61
  107. package/scripts/pezkuwi-dev-contrib.mjs +0 -74
  108. package/scripts/pezkuwi-dev-copy-dir.mjs +0 -44
  109. package/scripts/pezkuwi-dev-copy-to.mjs +0 -53
  110. package/scripts/pezkuwi-dev-deno-map.mjs +0 -35
  111. package/scripts/pezkuwi-dev-run-lint.mjs +0 -40
  112. package/scripts/pezkuwi-dev-run-node-ts.mjs +0 -9
  113. package/scripts/pezkuwi-dev-run-test.mjs +0 -163
  114. package/scripts/pezkuwi-dev-version.mjs +0 -143
  115. package/scripts/pezkuwi-dev-yarn-only.mjs +0 -11
  116. package/scripts/pezkuwi-exec-eslint.mjs +0 -7
  117. package/scripts/pezkuwi-exec-ghpages.mjs +0 -11
  118. package/scripts/pezkuwi-exec-ghrelease.mjs +0 -7
  119. package/scripts/pezkuwi-exec-node-test.mjs +0 -368
  120. package/scripts/pezkuwi-exec-rollup.mjs +0 -7
  121. package/scripts/pezkuwi-exec-tsc.mjs +0 -7
  122. package/scripts/pezkuwi-exec-webpack.mjs +0 -7
  123. package/scripts/util.mjs +0 -540
  124. package/types.d.ts +0 -15
  125. package/types.js +0 -1
  126. package/util.d.ts +0 -20
  127. package/util.js +0 -46
@@ -1,297 +0,0 @@
1
- type AssertMatchFn = (value: unknown) => void;
2
- /**
3
- * @internal
4
- *
5
- * A helper that wraps a matching function in an ExpectMatcher. This is (currently)
6
- * only used/checked for in the calledWith* helpers
7
- *
8
- * TODO We don't use it in pezkuwi-js, but a useful enhancement could be for
9
- * any of the to* expectations to detect and use those. An example of useful code
10
- * in that case:
11
- *
12
- * ```js
13
- * expect({
14
- * a: 'blah',
15
- * b: 3
16
- * }).toEqual(
17
- * expect.objectContaining({ b: 3 })
18
- * )
19
- * ```
20
- *
21
- * An example of matcher use can be seen in the isCalledWith loops
22
- */
23
- declare class Matcher {
24
- assertMatch: AssertMatchFn;
25
- constructor(assertFn: (value: any, check: any) => void, check?: unknown);
26
- }
27
- /**
28
- * Sets up the shimmed expect(...) function, including all .to* and .not.to*
29
- * functions. This is not comprehensive, rather is contains what we need to
30
- * make all pezkuwi-js usages pass
31
- **/
32
- export declare function expect(): {
33
- expect: ((value: unknown) => {
34
- not: {
35
- toBe: (other: unknown) => void;
36
- toBeDefined: () => void;
37
- toBeNull: (value: unknown) => void;
38
- toBeUndefined: () => void;
39
- toEqual: (other: unknown) => void;
40
- toHaveBeenCalled: () => void;
41
- toThrow: (message?: RegExp | Error | string) => void;
42
- } & Omit<{
43
- not: import("../types.js").StubFn;
44
- toMatchInlineSnapshot: import("../types.js").StubFn;
45
- toMatchSnapshot: import("../types.js").StubFn;
46
- toThrowErrorMatchingInlineSnapshot: import("../types.js").StubFn;
47
- toThrowErrorMatchingSnapshot: import("../types.js").StubFn;
48
- lastCalledWith: import("../types.js").StubFn;
49
- lastReturnedWith: import("../types.js").StubFn;
50
- nthCalledWith: import("../types.js").StubFn;
51
- nthReturnedWith: import("../types.js").StubFn;
52
- rejects: import("../types.js").StubFn;
53
- resolves: import("../types.js").StubFn;
54
- toBe: import("../types.js").StubFn;
55
- toBeCalled: import("../types.js").StubFn;
56
- toBeCalledTimes: import("../types.js").StubFn;
57
- toBeCalledWith: import("../types.js").StubFn;
58
- toBeCloseTo: import("../types.js").StubFn;
59
- toBeDefined: import("../types.js").StubFn;
60
- toBeFalsy: import("../types.js").StubFn;
61
- toBeGreaterThan: import("../types.js").StubFn;
62
- toBeGreaterThanOrEqual: import("../types.js").StubFn;
63
- toBeInstanceOf: import("../types.js").StubFn;
64
- toBeLessThan: import("../types.js").StubFn;
65
- toBeLessThanOrEqual: import("../types.js").StubFn;
66
- toBeNaN: import("../types.js").StubFn;
67
- toBeNull: import("../types.js").StubFn;
68
- toBeTruthy: import("../types.js").StubFn;
69
- toBeUndefined: import("../types.js").StubFn;
70
- toContain: import("../types.js").StubFn;
71
- toContainEqual: import("../types.js").StubFn;
72
- toEqual: import("../types.js").StubFn;
73
- toHaveBeenCalled: import("../types.js").StubFn;
74
- toHaveBeenCalledTimes: import("../types.js").StubFn;
75
- toHaveBeenCalledWith: import("../types.js").StubFn;
76
- toHaveBeenLastCalledWith: import("../types.js").StubFn;
77
- toHaveBeenNthCalledWith: import("../types.js").StubFn;
78
- toHaveLastReturnedWith: import("../types.js").StubFn;
79
- toHaveLength: import("../types.js").StubFn;
80
- toHaveNthReturnedWith: import("../types.js").StubFn;
81
- toHaveProperty: import("../types.js").StubFn;
82
- toHaveReturned: import("../types.js").StubFn;
83
- toHaveReturnedTimes: import("../types.js").StubFn;
84
- toHaveReturnedWith: import("../types.js").StubFn;
85
- toMatch: import("../types.js").StubFn;
86
- toMatchObject: import("../types.js").StubFn;
87
- toReturn: import("../types.js").StubFn;
88
- toReturnTimes: import("../types.js").StubFn;
89
- toReturnWith: import("../types.js").StubFn;
90
- toStrictEqual: import("../types.js").StubFn;
91
- toThrow: import("../types.js").StubFn;
92
- toThrowError: import("../types.js").StubFn;
93
- }, "toBe" | "toBeDefined" | "toBeNull" | "toBeUndefined" | "toEqual" | "toHaveBeenCalled" | "toThrow">;
94
- rejects: {
95
- toThrow: (message?: RegExp | Error | string) => Promise<void>;
96
- } & Omit<{
97
- not: import("../types.js").StubFn;
98
- toMatchInlineSnapshot: import("../types.js").StubFn;
99
- toMatchSnapshot: import("../types.js").StubFn;
100
- toThrowErrorMatchingInlineSnapshot: import("../types.js").StubFn;
101
- toThrowErrorMatchingSnapshot: import("../types.js").StubFn;
102
- lastCalledWith: import("../types.js").StubFn;
103
- lastReturnedWith: import("../types.js").StubFn;
104
- nthCalledWith: import("../types.js").StubFn;
105
- nthReturnedWith: import("../types.js").StubFn;
106
- rejects: import("../types.js").StubFn;
107
- resolves: import("../types.js").StubFn;
108
- toBe: import("../types.js").StubFn;
109
- toBeCalled: import("../types.js").StubFn;
110
- toBeCalledTimes: import("../types.js").StubFn;
111
- toBeCalledWith: import("../types.js").StubFn;
112
- toBeCloseTo: import("../types.js").StubFn;
113
- toBeDefined: import("../types.js").StubFn;
114
- toBeFalsy: import("../types.js").StubFn;
115
- toBeGreaterThan: import("../types.js").StubFn;
116
- toBeGreaterThanOrEqual: import("../types.js").StubFn;
117
- toBeInstanceOf: import("../types.js").StubFn;
118
- toBeLessThan: import("../types.js").StubFn;
119
- toBeLessThanOrEqual: import("../types.js").StubFn;
120
- toBeNaN: import("../types.js").StubFn;
121
- toBeNull: import("../types.js").StubFn;
122
- toBeTruthy: import("../types.js").StubFn;
123
- toBeUndefined: import("../types.js").StubFn;
124
- toContain: import("../types.js").StubFn;
125
- toContainEqual: import("../types.js").StubFn;
126
- toEqual: import("../types.js").StubFn;
127
- toHaveBeenCalled: import("../types.js").StubFn;
128
- toHaveBeenCalledTimes: import("../types.js").StubFn;
129
- toHaveBeenCalledWith: import("../types.js").StubFn;
130
- toHaveBeenLastCalledWith: import("../types.js").StubFn;
131
- toHaveBeenNthCalledWith: import("../types.js").StubFn;
132
- toHaveLastReturnedWith: import("../types.js").StubFn;
133
- toHaveLength: import("../types.js").StubFn;
134
- toHaveNthReturnedWith: import("../types.js").StubFn;
135
- toHaveProperty: import("../types.js").StubFn;
136
- toHaveReturned: import("../types.js").StubFn;
137
- toHaveReturnedTimes: import("../types.js").StubFn;
138
- toHaveReturnedWith: import("../types.js").StubFn;
139
- toMatch: import("../types.js").StubFn;
140
- toMatchObject: import("../types.js").StubFn;
141
- toReturn: import("../types.js").StubFn;
142
- toReturnTimes: import("../types.js").StubFn;
143
- toReturnWith: import("../types.js").StubFn;
144
- toStrictEqual: import("../types.js").StubFn;
145
- toThrow: import("../types.js").StubFn;
146
- toThrowError: import("../types.js").StubFn;
147
- }, "toThrow">;
148
- resolves: Omit<{
149
- not: import("../types.js").StubFn;
150
- toMatchInlineSnapshot: import("../types.js").StubFn;
151
- toMatchSnapshot: import("../types.js").StubFn;
152
- toThrowErrorMatchingInlineSnapshot: import("../types.js").StubFn;
153
- toThrowErrorMatchingSnapshot: import("../types.js").StubFn;
154
- lastCalledWith: import("../types.js").StubFn;
155
- lastReturnedWith: import("../types.js").StubFn;
156
- nthCalledWith: import("../types.js").StubFn;
157
- nthReturnedWith: import("../types.js").StubFn;
158
- rejects: import("../types.js").StubFn;
159
- resolves: import("../types.js").StubFn;
160
- toBe: import("../types.js").StubFn;
161
- toBeCalled: import("../types.js").StubFn;
162
- toBeCalledTimes: import("../types.js").StubFn;
163
- toBeCalledWith: import("../types.js").StubFn;
164
- toBeCloseTo: import("../types.js").StubFn;
165
- toBeDefined: import("../types.js").StubFn;
166
- toBeFalsy: import("../types.js").StubFn;
167
- toBeGreaterThan: import("../types.js").StubFn;
168
- toBeGreaterThanOrEqual: import("../types.js").StubFn;
169
- toBeInstanceOf: import("../types.js").StubFn;
170
- toBeLessThan: import("../types.js").StubFn;
171
- toBeLessThanOrEqual: import("../types.js").StubFn;
172
- toBeNaN: import("../types.js").StubFn;
173
- toBeNull: import("../types.js").StubFn;
174
- toBeTruthy: import("../types.js").StubFn;
175
- toBeUndefined: import("../types.js").StubFn;
176
- toContain: import("../types.js").StubFn;
177
- toContainEqual: import("../types.js").StubFn;
178
- toEqual: import("../types.js").StubFn;
179
- toHaveBeenCalled: import("../types.js").StubFn;
180
- toHaveBeenCalledTimes: import("../types.js").StubFn;
181
- toHaveBeenCalledWith: import("../types.js").StubFn;
182
- toHaveBeenLastCalledWith: import("../types.js").StubFn;
183
- toHaveBeenNthCalledWith: import("../types.js").StubFn;
184
- toHaveLastReturnedWith: import("../types.js").StubFn;
185
- toHaveLength: import("../types.js").StubFn;
186
- toHaveNthReturnedWith: import("../types.js").StubFn;
187
- toHaveProperty: import("../types.js").StubFn;
188
- toHaveReturned: import("../types.js").StubFn;
189
- toHaveReturnedTimes: import("../types.js").StubFn;
190
- toHaveReturnedWith: import("../types.js").StubFn;
191
- toMatch: import("../types.js").StubFn;
192
- toMatchObject: import("../types.js").StubFn;
193
- toReturn: import("../types.js").StubFn;
194
- toReturnTimes: import("../types.js").StubFn;
195
- toReturnWith: import("../types.js").StubFn;
196
- toStrictEqual: import("../types.js").StubFn;
197
- toThrow: import("../types.js").StubFn;
198
- toThrowError: import("../types.js").StubFn;
199
- }, never>;
200
- toBe: (other: unknown) => void;
201
- toBeDefined: () => void;
202
- toBeFalsy: () => void;
203
- toBeInstanceOf: (Clazz: Function) => void;
204
- toBeNull: (value: unknown) => void;
205
- toBeTruthy: () => void;
206
- toBeUndefined: () => void;
207
- toEqual: (other: unknown) => void;
208
- toHaveBeenCalled: () => void;
209
- toHaveBeenCalledTimes: (count: number) => void;
210
- toHaveBeenCalledWith: (...args: unknown[]) => void;
211
- toHaveBeenLastCalledWith: (...args: unknown[]) => void;
212
- toHaveLength: (length: number) => void;
213
- toMatch: (check: string | RegExp) => void;
214
- toMatchObject: (check: object) => void;
215
- toThrow: (message?: RegExp | Error | string) => void;
216
- } & Omit<{
217
- not: import("../types.js").StubFn;
218
- toMatchInlineSnapshot: import("../types.js").StubFn;
219
- toMatchSnapshot: import("../types.js").StubFn;
220
- toThrowErrorMatchingInlineSnapshot: import("../types.js").StubFn;
221
- toThrowErrorMatchingSnapshot: import("../types.js").StubFn;
222
- lastCalledWith: import("../types.js").StubFn;
223
- lastReturnedWith: import("../types.js").StubFn;
224
- nthCalledWith: import("../types.js").StubFn;
225
- nthReturnedWith: import("../types.js").StubFn;
226
- rejects: import("../types.js").StubFn;
227
- resolves: import("../types.js").StubFn;
228
- toBe: import("../types.js").StubFn;
229
- toBeCalled: import("../types.js").StubFn;
230
- toBeCalledTimes: import("../types.js").StubFn;
231
- toBeCalledWith: import("../types.js").StubFn;
232
- toBeCloseTo: import("../types.js").StubFn;
233
- toBeDefined: import("../types.js").StubFn;
234
- toBeFalsy: import("../types.js").StubFn;
235
- toBeGreaterThan: import("../types.js").StubFn;
236
- toBeGreaterThanOrEqual: import("../types.js").StubFn;
237
- toBeInstanceOf: import("../types.js").StubFn;
238
- toBeLessThan: import("../types.js").StubFn;
239
- toBeLessThanOrEqual: import("../types.js").StubFn;
240
- toBeNaN: import("../types.js").StubFn;
241
- toBeNull: import("../types.js").StubFn;
242
- toBeTruthy: import("../types.js").StubFn;
243
- toBeUndefined: import("../types.js").StubFn;
244
- toContain: import("../types.js").StubFn;
245
- toContainEqual: import("../types.js").StubFn;
246
- toEqual: import("../types.js").StubFn;
247
- toHaveBeenCalled: import("../types.js").StubFn;
248
- toHaveBeenCalledTimes: import("../types.js").StubFn;
249
- toHaveBeenCalledWith: import("../types.js").StubFn;
250
- toHaveBeenLastCalledWith: import("../types.js").StubFn;
251
- toHaveBeenNthCalledWith: import("../types.js").StubFn;
252
- toHaveLastReturnedWith: import("../types.js").StubFn;
253
- toHaveLength: import("../types.js").StubFn;
254
- toHaveNthReturnedWith: import("../types.js").StubFn;
255
- toHaveProperty: import("../types.js").StubFn;
256
- toHaveReturned: import("../types.js").StubFn;
257
- toHaveReturnedTimes: import("../types.js").StubFn;
258
- toHaveReturnedWith: import("../types.js").StubFn;
259
- toMatch: import("../types.js").StubFn;
260
- toMatchObject: import("../types.js").StubFn;
261
- toReturn: import("../types.js").StubFn;
262
- toReturnTimes: import("../types.js").StubFn;
263
- toReturnWith: import("../types.js").StubFn;
264
- toStrictEqual: import("../types.js").StubFn;
265
- toThrow: import("../types.js").StubFn;
266
- toThrowError: import("../types.js").StubFn;
267
- }, "not" | "rejects" | "resolves" | "toBe" | "toBeDefined" | "toBeFalsy" | "toBeInstanceOf" | "toBeNull" | "toBeTruthy" | "toBeUndefined" | "toEqual" | "toHaveBeenCalled" | "toHaveBeenCalledTimes" | "toHaveBeenCalledWith" | "toHaveBeenLastCalledWith" | "toHaveLength" | "toMatch" | "toMatchObject" | "toThrow">) & Omit<{
268
- any: (Clazz: Function) => Matcher;
269
- anything: () => Matcher;
270
- arrayContaining: (check: string) => Matcher;
271
- objectContaining: (check: object) => Matcher;
272
- stringContaining: (check: string) => Matcher;
273
- stringMatching: (check: string | RegExp) => Matcher;
274
- }, never> & Omit<{
275
- addEqualityTesters: import("../types.js").StubFn;
276
- addSnapshotSerializer: import("../types.js").StubFn;
277
- any: import("../types.js").StubFn;
278
- anything: import("../types.js").StubFn;
279
- arrayContaining: import("../types.js").StubFn;
280
- assertions: import("../types.js").StubFn;
281
- closeTo: import("../types.js").StubFn;
282
- extend: import("../types.js").StubFn;
283
- extractExpectedAssertionsErrors: import("../types.js").StubFn;
284
- getState: import("../types.js").StubFn;
285
- hasAssertions: import("../types.js").StubFn;
286
- not: import("../types.js").StubFn;
287
- objectContaining: import("../types.js").StubFn;
288
- setState: import("../types.js").StubFn;
289
- stringContaining: import("../types.js").StubFn;
290
- stringMatching: import("../types.js").StubFn;
291
- toMatchInlineSnapshot: import("../types.js").StubFn;
292
- toMatchSnapshot: import("../types.js").StubFn;
293
- toThrowErrorMatchingInlineSnapshot: import("../types.js").StubFn;
294
- toThrowErrorMatchingSnapshot: import("../types.js").StubFn;
295
- }, "any" | "anything" | "arrayContaining" | "objectContaining" | "stringContaining" | "stringMatching">;
296
- };
297
- export {};
package/cjs/env/expect.js DELETED
@@ -1,213 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.expect = expect;
4
- const node_assert_1 = require("node:assert");
5
- const util_js_1 = require("../util.js");
6
- const EXPECT_KEYS = ['addEqualityTesters', 'addSnapshotSerializer', 'any', 'anything', 'arrayContaining', 'assertions', 'closeTo', 'extend', 'extractExpectedAssertionsErrors', 'getState', 'hasAssertions', 'not', 'objectContaining', 'setState', 'stringContaining', 'stringMatching', 'toMatchInlineSnapshot', 'toMatchSnapshot', 'toThrowErrorMatchingInlineSnapshot', 'toThrowErrorMatchingSnapshot'];
7
- const EXPECT_KEYS_FN = ['lastCalledWith', 'lastReturnedWith', 'not', 'nthCalledWith', 'nthReturnedWith', 'rejects', 'resolves', 'toBe', 'toBeCalled', 'toBeCalledTimes', 'toBeCalledWith', 'toBeCloseTo', 'toBeDefined', 'toBeFalsy', 'toBeGreaterThan', 'toBeGreaterThanOrEqual', 'toBeInstanceOf', 'toBeLessThan', 'toBeLessThanOrEqual', 'toBeNaN', 'toBeNull', 'toBeTruthy', 'toBeUndefined', 'toContain', 'toContainEqual', 'toEqual', 'toHaveBeenCalled', 'toHaveBeenCalledTimes', 'toHaveBeenCalledWith', 'toHaveBeenLastCalledWith', 'toHaveBeenNthCalledWith', 'toHaveLastReturnedWith', 'toHaveLength', 'toHaveNthReturnedWith', 'toHaveProperty', 'toHaveReturned', 'toHaveReturnedTimes', 'toHaveReturnedWith', 'toMatch', 'toMatchInlineSnapshot', 'toMatchObject', 'toMatchSnapshot', 'toReturn', 'toReturnTimes', 'toReturnWith', 'toStrictEqual', 'toThrow', 'toThrowError', 'toThrowErrorMatchingInlineSnapshot', 'toThrowErrorMatchingSnapshot'];
8
- const stubExpect = (0, util_js_1.stubObj)('expect', EXPECT_KEYS);
9
- const stubExpectFn = (0, util_js_1.stubObj)('expect(...)', EXPECT_KEYS_FN, {
10
- toThrowError: 'expect(...).toThrow'
11
- });
12
- const stubExpectFnRejects = (0, util_js_1.stubObj)('expect(...).rejects', EXPECT_KEYS_FN, {
13
- toThrowError: 'expect(...).rejects.toThrow'
14
- });
15
- const stubExpectFnResolves = (0, util_js_1.stubObj)('expect(...).resolves', EXPECT_KEYS_FN);
16
- const stubExpectFnNot = (0, util_js_1.stubObj)('expect(...).not', EXPECT_KEYS_FN, {
17
- toBeFalsy: 'expect(...).toBeTruthy',
18
- toBeTruthy: 'expect(...).toBeFalsy',
19
- toThrowError: 'expect(...).not.toThrow'
20
- });
21
- /**
22
- * @internal
23
- *
24
- * A helper that wraps a matching function in an ExpectMatcher. This is (currently)
25
- * only used/checked for in the calledWith* helpers
26
- *
27
- * TODO We don't use it in pezkuwi-js, but a useful enhancement could be for
28
- * any of the to* expectations to detect and use those. An example of useful code
29
- * in that case:
30
- *
31
- * ```js
32
- * expect({
33
- * a: 'blah',
34
- * b: 3
35
- * }).toEqual(
36
- * expect.objectContaining({ b: 3 })
37
- * )
38
- * ```
39
- *
40
- * An example of matcher use can be seen in the isCalledWith loops
41
- */
42
- class Matcher {
43
- assertMatch;
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
- constructor(assertFn, check) {
46
- this.assertMatch = (value) => assertFn(value, check);
47
- }
48
- }
49
- /**
50
- * @internal
51
- *
52
- * Asserts that the input value is non-nullish
53
- */
54
- function assertNonNullish(value) {
55
- node_assert_1.strict.ok(value !== null && value !== undefined, `Expected non-nullish value, found ${value}`);
56
- }
57
- /**
58
- * @internal
59
- *
60
- * A helper that checks a single call arguments, which may include the
61
- * use of matchers. This is used in finding any call or checking a specific
62
- * call
63
- */
64
- function assertCallHasArgs(call, args) {
65
- node_assert_1.strict.ok(call && args.length === call.arguments?.length, 'Number of arguments does not match');
66
- args.forEach((arg, i) => assertMatch(call.arguments[i], arg));
67
- }
68
- /**
69
- * @internal
70
- *
71
- * A helper that checks for the first instance of a match on the actual call
72
- * arguments (this extracts the toHaveBeenCalledWith logic)
73
- */
74
- function assertSomeCallHasArgs(value, args) {
75
- node_assert_1.strict.ok(value?.mock?.calls.some((call) => {
76
- try {
77
- assertCallHasArgs(call, args);
78
- return true;
79
- }
80
- catch {
81
- return false;
82
- }
83
- }), 'No call found matching arguments');
84
- }
85
- /**
86
- * @internal
87
- *
88
- * Asserts that the value is either (equal deep) or matches the matcher (if supplied)
89
- */
90
- function assertMatch(value, check) {
91
- check instanceof Matcher
92
- ? check.assertMatch(value)
93
- : Array.isArray(check)
94
- ? assertMatchArr(value, check)
95
- : check && typeof check === 'object'
96
- ? assertMatchObj(value, check)
97
- : node_assert_1.strict.deepStrictEqual(value, check);
98
- }
99
- /**
100
- * @internal
101
- *
102
- * A helper to match the supplied array check against the resulting array
103
- *
104
- * @param {unknown} value
105
- * @param {unknown[]} check
106
- */
107
- function assertMatchArr(value, check) {
108
- node_assert_1.strict.ok(value && Array.isArray(value), `Expected array value, found ${typeof value}`);
109
- node_assert_1.strict.ok(value.length === check.length, `Expected array with ${check.length} entries, found ${value.length}`);
110
- check.forEach((other, i) => assertMatch(value[i], other));
111
- }
112
- /**
113
- * @internal
114
- *
115
- * A helper to match the supplied fields against the resulting object
116
- */
117
- function assertMatchObj(value, check) {
118
- node_assert_1.strict.ok(value && typeof value === 'object', `Expected object value, found ${typeof value}`);
119
- Object
120
- .entries(check)
121
- .forEach(([key, other]) => assertMatch(value[key], other));
122
- }
123
- /**
124
- * @internal
125
- *
126
- * A helper to match a string value against another string or regex
127
- */
128
- function assertMatchStr(value, check) {
129
- node_assert_1.strict.ok(typeof value === 'string', `Expected string value, found ${typeof value}`);
130
- typeof check === 'string'
131
- ? node_assert_1.strict.strictEqual(value, check)
132
- : node_assert_1.strict.match(value, check);
133
- }
134
- /**
135
- * @internal
136
- *
137
- * A helper to check the type of a specific value as used in the expect.any(Clazz) matcher
138
- *
139
- * @see https://github.com/facebook/jest/blob/a49c88610e49a3242576160740a32a2fe11161e1/packages/expect/src/asymmetricMatchers.ts#L103-L133
140
- */
141
- function assertInstanceOf(value, Clazz) {
142
- node_assert_1.strict.ok((Clazz === Array && Array.isArray(value)) ||
143
- (Clazz === BigInt && typeof value === 'bigint') ||
144
- (Clazz === Boolean && typeof value === 'boolean') ||
145
- (Clazz === Function && typeof value === 'function') ||
146
- (Clazz === Number && typeof value === 'number') ||
147
- (Clazz === Object && typeof value === 'object') ||
148
- (Clazz === String && typeof value === 'string') ||
149
- (Clazz === Symbol && typeof value === 'symbol') ||
150
- (value instanceof Clazz), `${value} is not an instance of ${Clazz.name}`);
151
- }
152
- /**
153
- * @internal
154
- *
155
- * A helper to ensure that the supplied string/array does include the checker string.
156
- *
157
- * @param {string | unknown[]} value
158
- * @param {string} check
159
- */
160
- function assertIncludes(value, [check, Clazz]) {
161
- assertInstanceOf(value, Clazz);
162
- node_assert_1.strict.ok(value?.includes(check), `${value} does not include ${check}`);
163
- }
164
- /**
165
- * Sets up the shimmed expect(...) function, including all .to* and .not.to*
166
- * functions. This is not comprehensive, rather is contains what we need to
167
- * make all pezkuwi-js usages pass
168
- **/
169
- function expect() {
170
- const rootMatchers = {
171
- // eslint-disable-next-line @typescript-eslint/ban-types
172
- any: (Clazz) => new Matcher(assertInstanceOf, Clazz),
173
- anything: () => new Matcher(assertNonNullish),
174
- arrayContaining: (check) => new Matcher(assertIncludes, [check, Array]),
175
- objectContaining: (check) => new Matcher(assertMatchObj, check),
176
- stringContaining: (check) => new Matcher(assertIncludes, [check, String]),
177
- stringMatching: (check) => new Matcher(assertMatchStr, check)
178
- };
179
- return {
180
- expect: (0, util_js_1.enhanceObj)((0, util_js_1.enhanceObj)((value) => (0, util_js_1.enhanceObj)({
181
- not: (0, util_js_1.enhanceObj)({
182
- toBe: (other) => node_assert_1.strict.notStrictEqual(value, other),
183
- toBeDefined: () => node_assert_1.strict.ok(value === undefined),
184
- toBeNull: (value) => node_assert_1.strict.ok(value !== null),
185
- toBeUndefined: () => node_assert_1.strict.ok(value !== undefined),
186
- toEqual: (other) => node_assert_1.strict.notDeepEqual(value, other),
187
- toHaveBeenCalled: () => node_assert_1.strict.ok(!value?.mock?.calls.length),
188
- toThrow: (message) => node_assert_1.strict.doesNotThrow(value, message && { message })
189
- }, stubExpectFnNot),
190
- rejects: (0, util_js_1.enhanceObj)({
191
- toThrow: (message) => node_assert_1.strict.rejects(value, message && { message })
192
- }, stubExpectFnRejects),
193
- resolves: (0, util_js_1.enhanceObj)({}, stubExpectFnResolves),
194
- toBe: (other) => node_assert_1.strict.strictEqual(value, other),
195
- toBeDefined: () => node_assert_1.strict.ok(value !== undefined),
196
- toBeFalsy: () => node_assert_1.strict.ok(!value),
197
- // eslint-disable-next-line @typescript-eslint/ban-types
198
- toBeInstanceOf: (Clazz) => assertInstanceOf(value, Clazz),
199
- toBeNull: (value) => node_assert_1.strict.ok(value === null),
200
- toBeTruthy: () => node_assert_1.strict.ok(value),
201
- toBeUndefined: () => node_assert_1.strict.ok(value === undefined),
202
- toEqual: (other) => node_assert_1.strict.deepEqual(value, other),
203
- toHaveBeenCalled: () => node_assert_1.strict.ok(value?.mock?.calls.length),
204
- toHaveBeenCalledTimes: (count) => node_assert_1.strict.equal(value?.mock?.calls.length, count),
205
- toHaveBeenCalledWith: (...args) => assertSomeCallHasArgs(value, args),
206
- toHaveBeenLastCalledWith: (...args) => assertCallHasArgs(value?.mock?.calls.at(-1), args),
207
- toHaveLength: (length) => node_assert_1.strict.equal(value?.length, length),
208
- toMatch: (check) => assertMatchStr(value, check),
209
- toMatchObject: (check) => assertMatchObj(value, check),
210
- toThrow: (message) => node_assert_1.strict.throws(value, message && { message })
211
- }, stubExpectFn), rootMatchers), stubExpect)
212
- };
213
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Exposes the jest-y environment via globals.
3
- */
4
- export declare function exposeEnv(isBrowser: boolean): void;
package/cjs/env/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.exposeEnv = exposeEnv;
4
- const browser_js_1 = require("./browser.js");
5
- const expect_js_1 = require("./expect.js");
6
- const jest_js_1 = require("./jest.js");
7
- const lifecycle_js_1 = require("./lifecycle.js");
8
- const suite_js_1 = require("./suite.js");
9
- /**
10
- * Exposes the jest-y environment via globals.
11
- */
12
- function exposeEnv(isBrowser) {
13
- [expect_js_1.expect, jest_js_1.jest, lifecycle_js_1.lifecycle, suite_js_1.suite, isBrowser && browser_js_1.browser].forEach((env) => {
14
- env && Object
15
- .entries(env())
16
- .forEach(([key, fn]) => {
17
- globalThis[key] ??= fn;
18
- });
19
- });
20
- }
package/cjs/env/jest.d.ts DELETED
@@ -1,127 +0,0 @@
1
- import type { AnyFn } from '../types.js';
2
- /**
3
- * Sets up the jest object. This is certainly not extensive, and probably
4
- * not quite meant to be (never say never). Rather this adds the functionality
5
- * that we use in the pezkuwi-js projects.
6
- **/
7
- export declare function jest(): {
8
- jest: {
9
- fn: <F extends AnyFn>(fn?: F) => F & {
10
- mock: {
11
- calls: {
12
- arguments: unknown[];
13
- }[];
14
- mockImplementation: (fn: AnyFn) => void;
15
- mockImplementationOnce: (fn: AnyFn) => void;
16
- resetCalls: () => void;
17
- restore: () => void;
18
- };
19
- } & Omit<{
20
- mockImplementation: <F_1 extends AnyFn>(fn: F_1) => void;
21
- mockImplementationOnce: <F_1 extends AnyFn>(fn: F_1) => void;
22
- mockReset: () => void;
23
- mockRestore: () => void;
24
- }, "mock" | keyof F> & Omit<{
25
- mock: import("../types.js").StubFn;
26
- _isMockFunction: import("../types.js").StubFn;
27
- getMockImplementation: import("../types.js").StubFn;
28
- getMockName: import("../types.js").StubFn;
29
- mockClear: import("../types.js").StubFn;
30
- mockImplementation: import("../types.js").StubFn;
31
- mockImplementationOnce: import("../types.js").StubFn;
32
- mockName: import("../types.js").StubFn;
33
- mockRejectedValue: import("../types.js").StubFn;
34
- mockRejectedValueOnce: import("../types.js").StubFn;
35
- mockReset: import("../types.js").StubFn;
36
- mockResolvedValue: import("../types.js").StubFn;
37
- mockResolvedValueOnce: import("../types.js").StubFn;
38
- mockRestore: import("../types.js").StubFn;
39
- mockReturnThis: import("../types.js").StubFn;
40
- mockReturnValue: import("../types.js").StubFn;
41
- mockReturnValueOnce: import("../types.js").StubFn;
42
- withImplementation: import("../types.js").StubFn;
43
- }, "mock" | keyof F | Exclude<"mockImplementation", "mock" | keyof F> | Exclude<"mockImplementationOnce", "mock" | keyof F> | Exclude<"mockReset", "mock" | keyof F> | Exclude<"mockRestore", "mock" | keyof F>>;
44
- restoreAllMocks: () => void;
45
- spyOn: <F extends AnyFn>(obj: object, key: string) => F & {
46
- mock: {
47
- calls: {
48
- arguments: unknown[];
49
- }[];
50
- mockImplementation: (fn: AnyFn) => void;
51
- mockImplementationOnce: (fn: AnyFn) => void;
52
- resetCalls: () => void;
53
- restore: () => void;
54
- };
55
- } & Omit<{
56
- mockImplementation: <F_1 extends AnyFn>(fn: F_1) => void;
57
- mockImplementationOnce: <F_1 extends AnyFn>(fn: F_1) => void;
58
- mockReset: () => void;
59
- mockRestore: () => void;
60
- }, "mock" | keyof F> & Omit<{
61
- mock: import("../types.js").StubFn;
62
- _isMockFunction: import("../types.js").StubFn;
63
- getMockImplementation: import("../types.js").StubFn;
64
- getMockName: import("../types.js").StubFn;
65
- mockClear: import("../types.js").StubFn;
66
- mockImplementation: import("../types.js").StubFn;
67
- mockImplementationOnce: import("../types.js").StubFn;
68
- mockName: import("../types.js").StubFn;
69
- mockRejectedValue: import("../types.js").StubFn;
70
- mockRejectedValueOnce: import("../types.js").StubFn;
71
- mockReset: import("../types.js").StubFn;
72
- mockResolvedValue: import("../types.js").StubFn;
73
- mockResolvedValueOnce: import("../types.js").StubFn;
74
- mockRestore: import("../types.js").StubFn;
75
- mockReturnThis: import("../types.js").StubFn;
76
- mockReturnValue: import("../types.js").StubFn;
77
- mockReturnValueOnce: import("../types.js").StubFn;
78
- withImplementation: import("../types.js").StubFn;
79
- }, "mock" | keyof F | Exclude<"mockImplementation", "mock" | keyof F> | Exclude<"mockImplementationOnce", "mock" | keyof F> | Exclude<"mockReset", "mock" | keyof F> | Exclude<"mockRestore", "mock" | keyof F>>;
80
- } & Omit<{
81
- setTimeout: import("../types.js").StubFn;
82
- }, "fn" | "restoreAllMocks" | "spyOn"> & Omit<{
83
- setTimeout: import("../types.js").StubFn;
84
- mock: import("../types.js").StubFn;
85
- advanceTimersByTime: import("../types.js").StubFn;
86
- advanceTimersToNextTimer: import("../types.js").StubFn;
87
- autoMockOff: import("../types.js").StubFn;
88
- autoMockOn: import("../types.js").StubFn;
89
- clearAllMocks: import("../types.js").StubFn;
90
- clearAllTimers: import("../types.js").StubFn;
91
- createMockFromModule: import("../types.js").StubFn;
92
- deepUnmock: import("../types.js").StubFn;
93
- disableAutomock: import("../types.js").StubFn;
94
- doMock: import("../types.js").StubFn;
95
- dontMock: import("../types.js").StubFn;
96
- enableAutomock: import("../types.js").StubFn;
97
- fn: import("../types.js").StubFn;
98
- genMockFromModule: import("../types.js").StubFn;
99
- getRealSystemTime: import("../types.js").StubFn;
100
- getSeed: import("../types.js").StubFn;
101
- getTimerCount: import("../types.js").StubFn;
102
- isEnvironmentTornDown: import("../types.js").StubFn;
103
- isMockFunction: import("../types.js").StubFn;
104
- isolateModules: import("../types.js").StubFn;
105
- isolateModulesAsync: import("../types.js").StubFn;
106
- mocked: import("../types.js").StubFn;
107
- now: import("../types.js").StubFn;
108
- replaceProperty: import("../types.js").StubFn;
109
- requireActual: import("../types.js").StubFn;
110
- requireMock: import("../types.js").StubFn;
111
- resetAllMocks: import("../types.js").StubFn;
112
- resetModules: import("../types.js").StubFn;
113
- restoreAllMocks: import("../types.js").StubFn;
114
- retryTimes: import("../types.js").StubFn;
115
- runAllImmediates: import("../types.js").StubFn;
116
- runAllTicks: import("../types.js").StubFn;
117
- runAllTimers: import("../types.js").StubFn;
118
- runOnlyPendingTimers: import("../types.js").StubFn;
119
- setMock: import("../types.js").StubFn;
120
- setSystemTime: import("../types.js").StubFn;
121
- spyOn: import("../types.js").StubFn;
122
- unmock: import("../types.js").StubFn;
123
- unstable_mockModule: import("../types.js").StubFn;
124
- useFakeTimers: import("../types.js").StubFn;
125
- useRealTimers: import("../types.js").StubFn;
126
- }, "setTimeout" | "fn" | "restoreAllMocks" | "spyOn">;
127
- };