assertron 10.0.0 → 10.4.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.
Files changed (188) hide show
  1. package/README.md +2 -1
  2. package/cjs/assert-order/AssertOrder.d.ts +1 -1
  3. package/cjs/assert-order/AssertOrder.d.ts.map +1 -1
  4. package/cjs/assert-order/AssertOrder.js +103 -176
  5. package/cjs/assert-order/AssertOrder.js.map +1 -1
  6. package/cjs/assert-order/InvalidOrder.d.ts +1 -1
  7. package/cjs/assert-order/InvalidOrder.d.ts.map +1 -1
  8. package/cjs/assert-order/InvalidOrder.js +18 -34
  9. package/cjs/assert-order/InvalidOrder.js.map +1 -1
  10. package/cjs/assert-order/StateMachine.d.ts +1 -1
  11. package/cjs/assert-order/StateMachine.d.ts.map +1 -1
  12. package/cjs/assert-order/StateMachine.js +102 -125
  13. package/cjs/assert-order/StateMachine.js.map +1 -1
  14. package/cjs/assert-order/types.d.ts.map +1 -1
  15. package/cjs/assertron/assertron.d.ts +20 -19
  16. package/cjs/assertron/assertron.d.ts.map +1 -1
  17. package/cjs/assertron/assertron.js +22 -13
  18. package/cjs/assertron/assertron.js.map +1 -1
  19. package/cjs/assertron/falsy.d.ts +1 -1
  20. package/cjs/assertron/falsy.d.ts.map +1 -1
  21. package/cjs/assertron/falsy.js +2 -2
  22. package/cjs/assertron/falsy.js.map +1 -1
  23. package/cjs/assertron/index.d.ts +1 -0
  24. package/cjs/assertron/index.d.ts.map +1 -1
  25. package/cjs/assertron/isInstanceof.d.ts +3 -0
  26. package/cjs/assertron/isInstanceof.d.ts.map +1 -0
  27. package/cjs/assertron/isInstanceof.js +11 -0
  28. package/cjs/assertron/isInstanceof.js.map +1 -0
  29. package/cjs/assertron/pathEqual.d.ts.map +1 -1
  30. package/cjs/assertron/pathEqual.js +3 -3
  31. package/cjs/assertron/pathEqual.js.map +1 -1
  32. package/cjs/assertron/rejects.d.ts +1 -1
  33. package/cjs/assertron/rejects.d.ts.map +1 -1
  34. package/cjs/assertron/rejects.js +5 -3
  35. package/cjs/assertron/rejects.js.map +1 -1
  36. package/cjs/assertron/repeat.d.ts.map +1 -1
  37. package/cjs/assertron/repeat.js +6 -4
  38. package/cjs/assertron/repeat.js.map +1 -1
  39. package/cjs/assertron/resolves.d.ts.map +1 -1
  40. package/cjs/assertron/resolves.js +5 -3
  41. package/cjs/assertron/resolves.js.map +1 -1
  42. package/cjs/assertron/satisfies.d.ts +4 -3
  43. package/cjs/assertron/satisfies.d.ts.map +1 -1
  44. package/cjs/assertron/satisfies.js +6 -5
  45. package/cjs/assertron/satisfies.js.map +1 -1
  46. package/cjs/assertron/throws.d.ts +1 -1
  47. package/cjs/assertron/throws.d.ts.map +1 -1
  48. package/cjs/assertron/throws.js +15 -11
  49. package/cjs/assertron/throws.js.map +1 -1
  50. package/cjs/assertron/truthy.d.ts +1 -1
  51. package/cjs/assertron/truthy.d.ts.map +1 -1
  52. package/cjs/assertron/truthy.js +2 -2
  53. package/cjs/assertron/truthy.js.map +1 -1
  54. package/cjs/errors.d.ts +3 -3
  55. package/cjs/errors.d.ts.map +1 -1
  56. package/cjs/errors.js +12 -32
  57. package/cjs/errors.js.map +1 -1
  58. package/cjs/index.d.ts +2 -1
  59. package/cjs/index.d.ts.map +1 -1
  60. package/cjs/index.js +16 -2
  61. package/cjs/index.js.map +1 -1
  62. package/cjs/package.json +1 -0
  63. package/cjs/types.d.ts +2 -2
  64. package/cjs/types.d.ts.map +1 -1
  65. package/cjs/utils/index.js +2 -2
  66. package/cjs/utils/index.js.map +1 -1
  67. package/cjs/utils/isErrorConstructor.d.ts +1 -1
  68. package/cjs/utils/isErrorConstructor.d.ts.map +1 -1
  69. package/cjs/utils/isErrorConstructor.js.map +1 -1
  70. package/cjs/utils/notEqualMessage.js +1 -1
  71. package/cjs/utils/notEqualMessage.js.map +1 -1
  72. package/cjs/utils/notSatisfiedMessage.d.ts +1 -1
  73. package/cjs/utils/notSatisfiedMessage.d.ts.map +1 -1
  74. package/cjs/utils/notSatisfiedMessage.js +12 -16
  75. package/cjs/utils/notSatisfiedMessage.js.map +1 -1
  76. package/cjs/utils/notThrownMessage.js +2 -2
  77. package/cjs/utils/notThrownMessage.js.map +1 -1
  78. package/cjs/utils/promiseMessages.d.ts.map +1 -1
  79. package/cjs/utils/promiseMessages.js +9 -5
  80. package/cjs/utils/promiseMessages.js.map +1 -1
  81. package/cjs/utils/unexpectedErrorMessage.d.ts +1 -1
  82. package/cjs/utils/unexpectedErrorMessage.d.ts.map +1 -1
  83. package/cjs/utils/unexpectedErrorMessage.js +3 -4
  84. package/cjs/utils/unexpectedErrorMessage.js.map +1 -1
  85. package/esm/assert-order/AssertOrder.d.ts +1 -1
  86. package/esm/assert-order/AssertOrder.d.ts.map +1 -1
  87. package/esm/assert-order/AssertOrder.js +12 -8
  88. package/esm/assert-order/AssertOrder.js.map +1 -1
  89. package/esm/assert-order/InvalidOrder.d.ts +1 -1
  90. package/esm/assert-order/InvalidOrder.d.ts.map +1 -1
  91. package/esm/assert-order/InvalidOrder.js +4 -2
  92. package/esm/assert-order/InvalidOrder.js.map +1 -1
  93. package/esm/assert-order/StateMachine.d.ts +1 -1
  94. package/esm/assert-order/StateMachine.d.ts.map +1 -1
  95. package/esm/assert-order/StateMachine.js +20 -10
  96. package/esm/assert-order/StateMachine.js.map +1 -1
  97. package/esm/assert-order/types.d.ts.map +1 -1
  98. package/esm/assertron/assertron.d.ts +20 -19
  99. package/esm/assertron/assertron.d.ts.map +1 -1
  100. package/esm/assertron/assertron.js +10 -1
  101. package/esm/assertron/assertron.js.map +1 -1
  102. package/esm/assertron/falsy.d.ts +1 -1
  103. package/esm/assertron/falsy.d.ts.map +1 -1
  104. package/esm/assertron/falsy.js.map +1 -1
  105. package/esm/assertron/index.d.ts +1 -0
  106. package/esm/assertron/index.d.ts.map +1 -1
  107. package/esm/assertron/isInstanceof.d.ts +3 -0
  108. package/esm/assertron/isInstanceof.d.ts.map +1 -0
  109. package/esm/assertron/isInstanceof.js +7 -0
  110. package/esm/assertron/isInstanceof.js.map +1 -0
  111. package/esm/assertron/pathEqual.d.ts.map +1 -1
  112. package/esm/assertron/pathEqual.js.map +1 -1
  113. package/esm/assertron/rejects.d.ts +1 -1
  114. package/esm/assertron/rejects.d.ts.map +1 -1
  115. package/esm/assertron/rejects.js +3 -1
  116. package/esm/assertron/rejects.js.map +1 -1
  117. package/esm/assertron/repeat.d.ts.map +1 -1
  118. package/esm/assertron/repeat.js +3 -1
  119. package/esm/assertron/repeat.js.map +1 -1
  120. package/esm/assertron/resolves.d.ts.map +1 -1
  121. package/esm/assertron/resolves.js +3 -1
  122. package/esm/assertron/resolves.js.map +1 -1
  123. package/esm/assertron/satisfies.d.ts +4 -3
  124. package/esm/assertron/satisfies.d.ts.map +1 -1
  125. package/esm/assertron/satisfies.js +2 -1
  126. package/esm/assertron/satisfies.js.map +1 -1
  127. package/esm/assertron/throws.d.ts +1 -1
  128. package/esm/assertron/throws.d.ts.map +1 -1
  129. package/esm/assertron/throws.js +7 -3
  130. package/esm/assertron/throws.js.map +1 -1
  131. package/esm/assertron/truthy.d.ts +1 -1
  132. package/esm/assertron/truthy.d.ts.map +1 -1
  133. package/esm/assertron/truthy.js.map +1 -1
  134. package/esm/errors.d.ts +3 -3
  135. package/esm/errors.d.ts.map +1 -1
  136. package/esm/errors.js.map +1 -1
  137. package/esm/index.d.ts +2 -1
  138. package/esm/index.d.ts.map +1 -1
  139. package/esm/index.js +2 -1
  140. package/esm/index.js.map +1 -1
  141. package/esm/types.d.ts +2 -2
  142. package/esm/types.d.ts.map +1 -1
  143. package/esm/utils/index.js.map +1 -1
  144. package/esm/utils/isErrorConstructor.d.ts +1 -1
  145. package/esm/utils/isErrorConstructor.d.ts.map +1 -1
  146. package/esm/utils/isErrorConstructor.js.map +1 -1
  147. package/esm/utils/notEqualMessage.js.map +1 -1
  148. package/esm/utils/notSatisfiedMessage.d.ts +1 -1
  149. package/esm/utils/notSatisfiedMessage.d.ts.map +1 -1
  150. package/esm/utils/notSatisfiedMessage.js +8 -3
  151. package/esm/utils/notSatisfiedMessage.js.map +1 -1
  152. package/esm/utils/notThrownMessage.js.map +1 -1
  153. package/esm/utils/promiseMessages.d.ts.map +1 -1
  154. package/esm/utils/promiseMessages.js +8 -4
  155. package/esm/utils/promiseMessages.js.map +1 -1
  156. package/esm/utils/unexpectedErrorMessage.d.ts +1 -1
  157. package/esm/utils/unexpectedErrorMessage.d.ts.map +1 -1
  158. package/esm/utils/unexpectedErrorMessage.js +1 -2
  159. package/esm/utils/unexpectedErrorMessage.js.map +1 -1
  160. package/package.json +56 -50
  161. package/ts/assert-order/AssertOrder.ts +139 -143
  162. package/ts/assert-order/InvalidOrder.ts +23 -19
  163. package/ts/assert-order/StateMachine.ts +97 -89
  164. package/ts/assert-order/index.ts +0 -1
  165. package/ts/assert-order/internalInterfaces.ts +3 -3
  166. package/ts/assert-order/types.ts +5 -5
  167. package/ts/assertron/assertron.ts +56 -18
  168. package/ts/assertron/falsy.ts +2 -3
  169. package/ts/assertron/index.ts +1 -0
  170. package/ts/assertron/isInstanceof.ts +11 -0
  171. package/ts/assertron/pathEqual.ts +3 -3
  172. package/ts/assertron/rejects.ts +7 -5
  173. package/ts/assertron/repeat.ts +27 -21
  174. package/ts/assertron/resolves.ts +7 -5
  175. package/ts/assertron/satisfies.ts +30 -22
  176. package/ts/assertron/throws.ts +76 -55
  177. package/ts/assertron/truthy.ts +2 -5
  178. package/ts/errors.ts +9 -9
  179. package/ts/index.ts +17 -1
  180. package/ts/testUtils.ts +52 -55
  181. package/ts/types.ts +0 -1
  182. package/ts/utils/index.ts +1 -1
  183. package/ts/utils/isErrorConstructor.ts +2 -2
  184. package/ts/utils/notEqualMessage.ts +1 -1
  185. package/ts/utils/notSatisfiedMessage.ts +18 -14
  186. package/ts/utils/notThrownMessage.ts +1 -1
  187. package/ts/utils/promiseMessages.ts +12 -5
  188. package/ts/utils/unexpectedErrorMessage.ts +4 -3
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":"AACA,oBAAY,cAAc,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAA;AACpD,oBAAY,gBAAgB,CAAC,CAAC,SAAS,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAA;AACpD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,KAAK,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAE3C,MAAM,UAAU,gBAAgB,CAAC,UAAkB,EAAE,KAAU;IAC7D,OAAO,aAAa,UAAU,gBAAgB,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAA;AACzF,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAE3C,MAAM,UAAU,gBAAgB,CAAC,UAAkB,EAAE,KAAU;IAC9D,OAAO,aAAa,UAAU,gBAAgB,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAA;AACxF,CAAC"}
@@ -1,3 +1,3 @@
1
- import { ErrorConstructor } from '../types.js';
1
+ import type { ErrorConstructor } from '../types.js';
2
2
  export declare function isErrorConstructor(validator: any): validator is ErrorConstructor<any>;
3
3
  //# sourceMappingURL=isErrorConstructor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isErrorConstructor.d.ts","sourceRoot":"","sources":["../../ts/utils/isErrorConstructor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAErF"}
1
+ {"version":3,"file":"isErrorConstructor.d.ts","sourceRoot":"","sources":["../../ts/utils/isErrorConstructor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,GAAG,GAAG,SAAS,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAErF"}
@@ -1 +1 @@
1
- {"version":3,"file":"isErrorConstructor.js","sourceRoot":"","sources":["../../ts/utils/isErrorConstructor.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,SAAc;IAC/C,OAAO,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;AAClF,CAAC"}
1
+ {"version":3,"file":"isErrorConstructor.js","sourceRoot":"","sources":["../../ts/utils/isErrorConstructor.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,SAAc;IAChD,OAAO,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;AACjF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"notEqualMessage.js","sourceRoot":"","sources":["../../ts/utils/notEqualMessage.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,MAAW,EAAE,QAAa;IACxD,OAAO,2BAA2B,QAAQ,kBAAkB,MAAM,EAAE,CAAA;AACtE,CAAC"}
1
+ {"version":3,"file":"notEqualMessage.js","sourceRoot":"","sources":["../../ts/utils/notEqualMessage.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,MAAW,EAAE,QAAa;IACzD,OAAO,2BAA2B,QAAQ,kBAAkB,MAAM,EAAE,CAAA;AACrE,CAAC"}
@@ -1,3 +1,3 @@
1
- import { Diff } from 'satisfier';
1
+ import type { Diff } from 'satisfier';
2
2
  export declare function notSatisfiedMessage(entries: Diff[]): string;
3
3
  //# sourceMappingURL=notSatisfiedMessage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notSatisfiedMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,UAKlD"}
1
+ {"version":3,"file":"notSatisfiedMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGrC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,UAOlD"}
@@ -1,9 +1,11 @@
1
1
  import { tersify } from 'tersify';
2
2
  export function notSatisfiedMessage(entries) {
3
- return entries.map(e => {
3
+ return entries
4
+ .map(e => {
4
5
  const path = formatPath(e.path);
5
6
  return `Expect ${path} to satisfy ${formatValue(e.expected)}, but received ${formatValue(e.actual)}`;
6
- }).join('\n');
7
+ })
8
+ .join('\n');
7
9
  }
8
10
  function formatPath(entries) {
9
11
  if (entries.length === 0)
@@ -12,7 +14,10 @@ function formatPath(entries) {
12
14
  if (isIndice(nodes[0])) {
13
15
  nodes.unshift('actual');
14
16
  }
15
- return nodes.map(n => isIndice(n) ? `[${n}]` : '.' + n).join('').slice(1);
17
+ return nodes
18
+ .map(n => (isIndice(n) ? `[${n}]` : '.' + n))
19
+ .join('')
20
+ .slice(1);
16
21
  }
17
22
  function isIndice(node) {
18
23
  return typeof node === 'number';
@@ -1 +1 @@
1
- {"version":3,"file":"notSatisfiedMessage.js","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAC/B,OAAO,UAAU,IAAI,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAA;IACtG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAED,SAAS,UAAU,CAAC,OAA4B;IAC9C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QACtB,OAAO,QAAQ,CAAA;IACjB,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAA;IAC1B,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;QACtB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;KACxB;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAC,IAAqB;IACrC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAA;AACjC,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,OAAO,CAAC,KAAK,CAAC,CAAA;AACvB,CAAC"}
1
+ {"version":3,"file":"notSatisfiedMessage.js","sourceRoot":"","sources":["../../ts/utils/notSatisfiedMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAClD,OAAO,OAAO;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE;QACR,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAC/B,OAAO,UAAU,IAAI,eAAe,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAA;IACrG,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AACb,CAAC;AAED,SAAS,UAAU,CAAC,OAA4B;IAC/C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAA;IACzC,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,CAAC,CAAA;IAC1B,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;QACvB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;KACvB;IACD,OAAO,KAAK;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;SAC5C,IAAI,CAAC,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,CAAC,CAAA;AACX,CAAC;AAED,SAAS,QAAQ,CAAC,IAAqB;IACtC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAA;AAChC,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC9B,OAAO,OAAO,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"notThrownMessage.js","sourceRoot":"","sources":["../../ts/utils/notThrownMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,UAAU,gBAAgB,CAAC,KAAU;IACzC,OAAO,8CAA8C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAA;AACjF,CAAC"}
1
+ {"version":3,"file":"notThrownMessage.js","sourceRoot":"","sources":["../../ts/utils/notThrownMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,UAAU,gBAAgB,CAAC,KAAU;IAC1C,OAAO,8CAA8C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAA;AAChF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"promiseMessages.d.ts","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAG5C;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAG5C"}
1
+ {"version":3,"file":"promiseMessages.d.ts","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAK5C;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,UAS5C"}
@@ -1,10 +1,14 @@
1
1
  import { tersify } from 'tersify';
2
2
  export function notRejectedMessage(value) {
3
- return `Expected promise to reject, but it resolves with ` + (typeof value === 'string'
4
- ? `'${value}'` : tersify(value, { maxLength: Infinity }));
3
+ return (`Expected promise to reject, but it resolves with ` +
4
+ (typeof value === 'string' ? `'${value}'` : tersify(value, { maxLength: Infinity })));
5
5
  }
6
6
  export function notResolvedMessage(error) {
7
- return `Expected promise to resolve, but it rejects with ` + (typeof error === 'string'
8
- ? `'${error}'` : error instanceof Error ? error : tersify(error, { maxLength: Infinity }));
7
+ return (`Expected promise to resolve, but it rejects with ` +
8
+ (typeof error === 'string'
9
+ ? `'${error}'`
10
+ : error instanceof Error
11
+ ? error
12
+ : tersify(error, { maxLength: Infinity })));
9
13
  }
10
14
  //# sourceMappingURL=promiseMessages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"promiseMessages.js","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,UAAU,kBAAkB,CAAC,KAAU;IAC3C,OAAO,mDAAmD,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ;QACrF,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAU;IAC3C,OAAO,mDAAmD,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ;QACrF,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;AAC9F,CAAC"}
1
+ {"version":3,"file":"promiseMessages.js","sourceRoot":"","sources":["../../ts/utils/promiseMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,UAAU,kBAAkB,CAAC,KAAU;IAC5C,OAAO,CACN,mDAAmD;QACnD,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CACpF,CAAA;AACF,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAU;IAC5C,OAAO,CACN,mDAAmD;QACnD,CAAC,OAAO,KAAK,KAAK,QAAQ;YACzB,CAAC,CAAC,IAAI,KAAK,GAAG;YACd,CAAC,CAAC,KAAK,YAAY,KAAK;gBACxB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAC3C,CAAA;AACF,CAAC"}
@@ -1,3 +1,3 @@
1
- import { ErrorConstructor, ErrorValidator } from '../types.js';
1
+ import type { ErrorConstructor, ErrorValidator } from '../types.js';
2
2
  export declare function unexpectedErrorMessage(actual: any, expected: ErrorValidator | ErrorConstructor<any>): string;
3
3
  //# sourceMappingURL=unexpectedErrorMessage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unexpectedErrorMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG9D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAGnG"}
1
+ {"version":3,"file":"unexpectedErrorMessage.d.ts","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGnE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAInG"}
@@ -1,7 +1,6 @@
1
1
  import { tersify } from 'tersify';
2
2
  import { isErrorConstructor } from './isErrorConstructor.js';
3
3
  export function unexpectedErrorMessage(actual, expected) {
4
- return `Unexpected error. Expecting '${isErrorConstructor(expected) ?
5
- expected.name : tersify(expected)}' but received ${tersify(actual)}`;
4
+ return `Unexpected error. Expecting '${isErrorConstructor(expected) ? expected.name : tersify(expected)}' but received ${tersify(actual)}`;
6
5
  }
7
6
  //# sourceMappingURL=unexpectedErrorMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unexpectedErrorMessage.js","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,UAAU,sBAAsB,CAAC,MAAW,EAAE,QAAgD;IAClG,OAAO,gCAAgC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;AACxE,CAAC"}
1
+ {"version":3,"file":"unexpectedErrorMessage.js","sourceRoot":"","sources":["../../ts/utils/unexpectedErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,UAAU,sBAAsB,CAAC,MAAW,EAAE,QAAgD;IACnG,OAAO,gCACN,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAChE,kBAAkB,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;AACpC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assertron",
3
- "version": "10.0.0",
3
+ "version": "10.4.0",
4
4
  "description": "A supplementary assertion library",
5
5
  "homepage": "https://github.com/unional/assertron",
6
6
  "bugs": {
@@ -18,10 +18,17 @@
18
18
  "sideEffects": false,
19
19
  "type": "module",
20
20
  "exports": {
21
- "import": "./esm/index.js",
22
- "require": "./cjs/index.js"
21
+ "import": {
22
+ "types": "./esm/index.d.ts",
23
+ "default": "./esm/index.js"
24
+ },
25
+ "require": {
26
+ "types": "./cjs/index.d.ts",
27
+ "default": "./cjs/index.js"
28
+ }
23
29
  },
24
30
  "main": "./cjs/index.js",
31
+ "module": "./esm/index.js",
25
32
  "browser": {
26
33
  "perf_hooks": false
27
34
  },
@@ -30,69 +37,50 @@
30
37
  "cjs",
31
38
  "esm",
32
39
  "ts",
33
- "!ts/**/*.spec.ts"
40
+ "!**/*.{spec,test,unit,accept,integrate,system,perf,stress}.*"
34
41
  ],
35
- "scripts": {
36
- "build": "run-p build:cjs build:esm build:tslib",
37
- "build:cjs": "tsc -p tsconfig.cjs.json",
38
- "build:esm": "tsc -p tsconfig.esm.json",
39
- "build:tslib": "tsc -p tsconfig.tslib.json",
40
- "build:watch": "tsc --watch",
41
- "clean": "rimraf cjs esm coverage lib libm",
42
- "coverage": "jest --coverage",
43
- "depcheck": "depcheck",
44
- "lint": "eslint --ext=js,ts .",
45
- "_postinstall": "husky install",
46
- "prepack": "pinst --disable",
47
- "postpack": "pinst --enable",
48
- "nuke": "yarn clean && rimraf node_modules",
49
- "size": "size-limit",
50
- "test": "jest",
51
- "test:watch": "jest --watch",
52
- "test:type": "tsc",
53
- "verify": "npm-run-all clean -p build test:type depcheck lint coverage -p size",
54
- "watch": "yarn test:watch"
55
- },
56
42
  "dependencies": {
57
43
  "is-promise": "^4.0.0",
58
- "iso-error": "^4.3.5",
59
- "path-equal": "^1.2.2",
60
- "satisfier": "^5.2.2",
61
- "tersify": "^3.10.2",
62
- "type-plus": "^4.10.1"
44
+ "iso-error": "^6.0.0",
45
+ "path-equal": "^1.2.5",
46
+ "satisfier": "^5.4.2",
47
+ "tersify": "^3.11.1",
48
+ "type-plus": "^7.6.0"
63
49
  },
64
50
  "devDependencies": {
51
+ "@changesets/cli": "^2.26.2",
65
52
  "@commitlint/cli": "^17.0.2",
66
53
  "@commitlint/config-conventional": "^17.0.2",
67
- "@semantic-release/changelog": "^6.0.1",
68
- "@semantic-release/git": "^10.0.1",
69
- "@semantic-release/github": "^8.0.4",
70
- "@size-limit/preset-small-lib": "^7.0.8",
71
- "@types/jest": "^28.1.1",
54
+ "@size-limit/preset-small-lib": "^8.0.0",
55
+ "@types/jest": "^29.0.0",
72
56
  "@types/lodash": "^4.14.182",
73
- "@types/node": "^14.18.21",
74
- "@typescript-eslint/eslint-plugin": "^5.27.1",
57
+ "@types/ncp": "^2",
58
+ "@types/node": "^18.0.0",
59
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
75
60
  "depcheck": "^1.4.3",
76
61
  "eslint": "^8.17.0",
77
62
  "eslint-config-prettier": "^8.5.0",
78
63
  "eslint-plugin-harmony": "^7.1.0",
79
64
  "husky": "^8.0.1",
80
- "jest": "^28.1.1",
81
- "jest-validate": "^28.1.1",
65
+ "jest": "^29.0.0",
66
+ "jest-validate": "^29.0.0",
82
67
  "jest-watch-suspend": "^1.1.2",
83
- "jest-watch-toggle-config": "^2.0.1",
84
- "jest-watch-typeahead": "^1.1.0",
68
+ "jest-watch-toggle-config": "^3.0.0",
69
+ "jest-watch-typeahead": "^2.0.0",
85
70
  "lodash": "^4.17.21",
71
+ "ncp": "^2.0.0",
86
72
  "npm-run-all": "^4.1.5",
87
73
  "pinst": "^3.0.0",
88
- "rimraf": "^3.0.2",
89
- "semantic-release": "^19.0.3",
90
- "size-limit": "^7.0.8",
91
- "ts-jest": "^28.0.4",
74
+ "rimraf": "^5.0.0",
75
+ "size-limit": "^8.0.0",
76
+ "ts-jest": "^29.0.0",
92
77
  "tslib": "^2.4.0",
93
- "typescript": "^4.7.3"
78
+ "typescript": "^5.0.0"
79
+ },
80
+ "packageManager": "pnpm@8.6.7",
81
+ "engines": {
82
+ "node": ">= 10"
94
83
  },
95
- "packageManager": "yarn@3.2.1",
96
84
  "size-limit": [
97
85
  {
98
86
  "path": "./cjs/index.js",
@@ -107,7 +95,25 @@
107
95
  "limit": "15 KB"
108
96
  }
109
97
  ],
110
- "engines": {
111
- "node": ">= 10"
98
+ "scripts": {
99
+ "build": "run-p build:cjs build:esm build:tslib",
100
+ "build:cjs": "tsc -p tsconfig.cjs.json && ncp package.cjs.json cjs/package.json",
101
+ "build:esm": "tsc -p tsconfig.esm.json",
102
+ "build:tslib": "tsc -p tsconfig.tslib.json && ncp package.cjs.json tslib/package.json",
103
+ "build:watch": "tsc --watch",
104
+ "clean": "rimraf cjs esm coverage lib libm",
105
+ "cs": "changeset",
106
+ "coverage": "jest --coverage",
107
+ "depcheck": "depcheck",
108
+ "lint": "eslint --ext=js,ts .",
109
+ "nuke": "pnpm clean && rimraf node_modules",
110
+ "size": "size-limit",
111
+ "test": "jest",
112
+ "test:watch": "jest --watch",
113
+ "test:type": "tsc",
114
+ "release": "changeset publish",
115
+ "version": "changeset version",
116
+ "verify": "npm-run-all clean -p build test:type depcheck lint coverage -p size",
117
+ "watch": "pnpm test:watch"
112
118
  }
113
- }
119
+ }
@@ -5,147 +5,143 @@ import { StateMachine } from './StateMachine.js'
5
5
  // order.atMost(step, count) // exected to be executed at most `count` times
6
6
 
7
7
  export class AssertOrder {
8
- /**
9
- * Gets the current expecting step.
10
- */
11
- get currentStep() {
12
- return this.state.step
13
- }
14
-
15
- private state: StateMachine
16
- constructor(plan?: number) {
17
- this.state = new StateMachine(plan)
18
- }
19
-
20
- /**
21
- * Asserts the current step is `step`.
22
- * @param step expected step.
23
- */
24
- is(step: number) {
25
- this.assert('is', step)
26
- }
27
-
28
- /**
29
- * Asserts the current step is not `step`.
30
- * @param step not expected step.
31
- */
32
- not(step: number) {
33
- if (this.state.isValid(step)) {
34
- throw new InvalidOrder(this.state.get(), 'not', [step], { ssf: this.not })
35
- }
36
- }
37
-
38
- /**
39
- * Reset to specified step.
40
- */
41
- jump(step: number) {
42
- this.state.jump(step)
43
- }
44
-
45
- /**
46
- * Move to next step.
47
- */
48
- move() {
49
- this.state.move()
50
- }
51
-
52
- /**
53
- * Asserts the specified step will run once.
54
- */
55
- once(step: number) {
56
- this.assert('once', step)
57
- this.state.move()
58
- }
59
-
60
- on(step: number, assert: (step: number) => void) {
61
- this.state.on(step, () => {
62
- assert(step)
63
- })
64
- }
65
-
66
- atLeastOnce(step: number) {
67
- const nextStep = step + 1
68
- if (this.state.step === step) {
69
- this.state.move()
70
- return this.state.moveSubStep()
71
- }
72
- else if (this.state.step === nextStep && this.state.subStep > 0) {
73
- return this.state.moveSubStep()
74
- }
75
- else
76
- throw new InvalidOrder(this.state.get(), 'atLeastOnce', [step], { ssf: this.atLeastOnce })
77
- }
78
-
79
- any(steps: number[]) {
80
- const index = steps.indexOf(this.state.step)
81
- if (index === -1)
82
- throw new InvalidOrder(this.state.get(), 'any', [steps], { ssf: this.any })
83
-
84
- this.state.move()
85
- return steps[index]
86
- }
87
- onAny(steps: number[], ...asserts: Array<(...args: any[]) => any>) {
88
- steps.forEach(step => {
89
- this.state.on(step, () => {
90
- let firstError: any
91
- let hasPass = false
92
- asserts.forEach(assert => {
93
- try {
94
- assert(step)
95
- hasPass = true
96
- }
97
- catch (err) {
98
- if (!firstError) firstError = err
99
- }
100
- })
101
- if (!hasPass)
102
- throw firstError
103
- })
104
- })
105
- return
106
- }
107
- end(timeout: number): Promise<number>
108
- end(): number
109
- end(timeout?: number) {
110
- if (timeout) {
111
- return new Promise(r => {
112
- setTimeout(r, timeout)
113
- }).then(() => {
114
- return this.end()
115
- })
116
- }
117
-
118
- if (!this.state.isMaxStepDefined()) {
119
- this.state.stopAccepting()
120
- return this.state.getTimeTaken()
121
- }
122
-
123
- if (this.state.isAccepting()) {
124
- throw new InvalidOrder(this.state.get(), 'end', [], { ssf: this.end })
125
- }
126
- }
127
- exactly(step: number, times: number) {
128
- if (this.state.isNotValid(step))
129
- throw new InvalidOrder(this.state.get(), 'exactly', [step, times], { ssf: this.exactly })
130
-
131
- if (this.state.maxSubStep === undefined) {
132
- this.state.maxSubStep = times
133
- this.state.minSubStep = times
134
- }
135
-
136
- return this.state.moveSubStep()
137
- }
138
- wait(step: number): Promise<void>
139
- wait(step: number, callback: () => void): void
140
- wait(step: number, callback?: () => void) {
141
- if (callback)
142
- this.on(step, callback)
143
- else
144
- return new Promise<any>(a => { this.on(step, a) })
145
- }
146
- private assert(method: string, step: number) {
147
- if (this.state.isNotValid(step)) {
148
- throw new InvalidOrder(this.state.get(), method, [step], { ssf: (this as any)[method] })
149
- }
150
- }
8
+ /**
9
+ * Gets the current expecting step.
10
+ */
11
+ get currentStep() {
12
+ return this.state.step
13
+ }
14
+
15
+ private state: StateMachine
16
+ constructor(plan?: number) {
17
+ this.state = new StateMachine(plan)
18
+ }
19
+
20
+ /**
21
+ * Asserts the current step is `step`.
22
+ * @param step expected step.
23
+ */
24
+ is(step: number) {
25
+ this.assert('is', step)
26
+ }
27
+
28
+ /**
29
+ * Asserts the current step is not `step`.
30
+ * @param step not expected step.
31
+ */
32
+ not(step: number) {
33
+ if (this.state.isValid(step)) {
34
+ throw new InvalidOrder(this.state.get(), 'not', [step], { ssf: this.not })
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Reset to specified step.
40
+ */
41
+ jump(step: number) {
42
+ this.state.jump(step)
43
+ }
44
+
45
+ /**
46
+ * Move to next step.
47
+ */
48
+ move() {
49
+ this.state.move()
50
+ }
51
+
52
+ /**
53
+ * Asserts the specified step will run once.
54
+ */
55
+ once(step: number) {
56
+ this.assert('once', step)
57
+ this.state.move()
58
+ }
59
+
60
+ on(step: number, assert: (step: number) => void) {
61
+ this.state.on(step, () => {
62
+ assert(step)
63
+ })
64
+ }
65
+
66
+ atLeastOnce(step: number) {
67
+ const nextStep = step + 1
68
+ if (this.state.step === step) {
69
+ this.state.move()
70
+ return this.state.moveSubStep()
71
+ } else if (this.state.step === nextStep && this.state.subStep > 0) {
72
+ return this.state.moveSubStep()
73
+ } else throw new InvalidOrder(this.state.get(), 'atLeastOnce', [step], { ssf: this.atLeastOnce })
74
+ }
75
+
76
+ any(steps: number[], handler?: (step: number) => void) {
77
+ const index = steps.indexOf(this.state.step)
78
+ if (index === -1) throw new InvalidOrder(this.state.get(), 'any', [steps], { ssf: this.any })
79
+ if (handler) handler(steps[index])
80
+
81
+ this.state.move()
82
+ return steps[index]
83
+ }
84
+ onAny(steps: number[], ...asserts: Array<(...args: any[]) => any>) {
85
+ steps.forEach(step => {
86
+ this.state.on(step, () => {
87
+ let firstError: any
88
+ let hasPass = false
89
+ asserts.forEach(assert => {
90
+ try {
91
+ assert(step)
92
+ hasPass = true
93
+ } catch (err) {
94
+ if (!firstError) firstError = err
95
+ }
96
+ })
97
+ if (!hasPass) throw firstError
98
+ })
99
+ })
100
+ return
101
+ }
102
+ end(timeout: number): Promise<number>
103
+ end(): number
104
+ end(timeout?: number) {
105
+ if (timeout) {
106
+ return new Promise(r => {
107
+ setTimeout(r, timeout)
108
+ }).then(() => {
109
+ return this.end()
110
+ })
111
+ }
112
+
113
+ if (!this.state.isMaxStepDefined()) {
114
+ this.state.stopAccepting()
115
+ return this.state.getTimeTaken()
116
+ }
117
+
118
+ if (this.state.isAccepting()) {
119
+ throw new InvalidOrder(this.state.get(), 'end', [], { ssf: this.end })
120
+ }
121
+ }
122
+ exactly(step: number, times: number) {
123
+ if (this.state.isNotValid(step))
124
+ throw new InvalidOrder(this.state.get(), 'exactly', [step, times], { ssf: this.exactly })
125
+
126
+ if (this.state.maxSubStep === undefined) {
127
+ this.state.maxSubStep = times
128
+ this.state.minSubStep = times
129
+ }
130
+
131
+ return this.state.moveSubStep()
132
+ }
133
+ wait(step: number): Promise<void>
134
+ wait(step: number, callback: () => void): void
135
+ wait(step: number, callback?: () => void) {
136
+ if (callback) this.on(step, callback)
137
+ else
138
+ return new Promise<any>(a => {
139
+ this.on(step, a)
140
+ })
141
+ }
142
+ private assert(method: string, step: number) {
143
+ if (this.state.isNotValid(step)) {
144
+ throw new InvalidOrder(this.state.get(), method, [step], { ssf: (this as any)[method] })
145
+ }
146
+ }
151
147
  }