xunit.ts 1.0.1 → 1.1.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 (168) hide show
  1. package/.editorconfig +2 -0
  2. package/.eslintrc.json +37 -0
  3. package/README.md +6 -2
  4. package/cli.ts +5 -5
  5. package/dist/cli.js.map +1 -1
  6. package/dist/src/Assertions/Contains.js +1 -1
  7. package/dist/src/Assertions/Contains.js.map +1 -1
  8. package/dist/src/Assertions/Count.js.map +1 -1
  9. package/dist/src/Assertions/Defined.js +2 -2
  10. package/dist/src/Assertions/Defined.js.map +1 -1
  11. package/dist/src/Assertions/DoesNotContain.js +1 -1
  12. package/dist/src/Assertions/DoesNotContain.js.map +1 -1
  13. package/dist/src/Assertions/DoesNotThrow.js +2 -2
  14. package/dist/src/Assertions/DoesNotThrow.js.map +1 -1
  15. package/dist/src/Assertions/Empty.js +1 -1
  16. package/dist/src/Assertions/Empty.js.map +1 -1
  17. package/dist/src/Assertions/Equal.js +1 -1
  18. package/dist/src/Assertions/Equal.js.map +1 -1
  19. package/dist/src/Assertions/False.js +1 -1
  20. package/dist/src/Assertions/False.js.map +1 -1
  21. package/dist/src/Assertions/InstanceOf.d.ts +1 -1
  22. package/dist/src/Assertions/InstanceOf.d.ts.map +1 -1
  23. package/dist/src/Assertions/InstanceOf.js +1 -1
  24. package/dist/src/Assertions/InstanceOf.js.map +1 -1
  25. package/dist/src/Assertions/NotEmpty.js +2 -2
  26. package/dist/src/Assertions/NotEmpty.js.map +1 -1
  27. package/dist/src/Assertions/NotEqual.js +1 -1
  28. package/dist/src/Assertions/NotEqual.js.map +1 -1
  29. package/dist/src/Assertions/NotNull.js +2 -2
  30. package/dist/src/Assertions/NotNull.js.map +1 -1
  31. package/dist/src/Assertions/Null.js +1 -1
  32. package/dist/src/Assertions/Null.js.map +1 -1
  33. package/dist/src/Assertions/StringContains.js +1 -1
  34. package/dist/src/Assertions/StringContains.js.map +1 -1
  35. package/dist/src/Assertions/StringDoesNotContain.d.ts.map +1 -1
  36. package/dist/src/Assertions/StringDoesNotContain.js +1 -1
  37. package/dist/src/Assertions/StringDoesNotContain.js.map +1 -1
  38. package/dist/src/Assertions/StringDoesNotEndWith.js +1 -1
  39. package/dist/src/Assertions/StringDoesNotEndWith.js.map +1 -1
  40. package/dist/src/Assertions/StringDoesNotStartWith.d.ts.map +1 -1
  41. package/dist/src/Assertions/StringDoesNotStartWith.js +1 -1
  42. package/dist/src/Assertions/StringDoesNotStartWith.js.map +1 -1
  43. package/dist/src/Assertions/StringEndsWith.js +1 -1
  44. package/dist/src/Assertions/StringEndsWith.js.map +1 -1
  45. package/dist/src/Assertions/StringStartsWith.d.ts.map +1 -1
  46. package/dist/src/Assertions/StringStartsWith.js +1 -1
  47. package/dist/src/Assertions/StringStartsWith.js.map +1 -1
  48. package/dist/src/Assertions/Throws.js +1 -1
  49. package/dist/src/Assertions/Throws.js.map +1 -1
  50. package/dist/src/Assertions/True.js +1 -1
  51. package/dist/src/Assertions/True.js.map +1 -1
  52. package/dist/src/Assertions/Undefined.js +1 -1
  53. package/dist/src/Assertions/Undefined.js.map +1 -1
  54. package/dist/src/Assertions/index.d.ts +22 -22
  55. package/dist/src/Assertions/index.d.ts.map +1 -1
  56. package/dist/src/Assertions/index.js.map +1 -1
  57. package/dist/src/CLI.d.ts.map +1 -1
  58. package/dist/src/CLI.js +19 -8
  59. package/dist/src/CLI.js.map +1 -1
  60. package/dist/src/Factory.d.ts +4 -4
  61. package/dist/src/Factory.d.ts.map +1 -1
  62. package/dist/src/Factory.js.map +1 -1
  63. package/dist/src/Framework/ResultType.d.ts.map +1 -1
  64. package/dist/src/Framework/ResultType.js.map +1 -1
  65. package/dist/src/Framework/Test.d.ts.map +1 -1
  66. package/dist/src/Framework/Test.js.map +1 -1
  67. package/dist/src/Framework/TestName.d.ts.map +1 -1
  68. package/dist/src/Framework/TestName.js.map +1 -1
  69. package/dist/src/Framework/TestResult.d.ts.map +1 -1
  70. package/dist/src/Framework/TestResult.js.map +1 -1
  71. package/dist/src/Framework/TestSuite.d.ts +3 -2
  72. package/dist/src/Framework/TestSuite.d.ts.map +1 -1
  73. package/dist/src/Framework/TestSuite.js +12 -2
  74. package/dist/src/Framework/TestSuite.js.map +1 -1
  75. package/dist/src/Framework/TestSuiteResults.d.ts +1 -1
  76. package/dist/src/Framework/TestSuiteResults.d.ts.map +1 -1
  77. package/dist/src/Framework/TestSuiteResults.js.map +1 -1
  78. package/dist/src/IO/FileSystem.d.ts +2 -2
  79. package/dist/src/IO/FileSystem.d.ts.map +1 -1
  80. package/dist/src/IO/FileSystem.js +6 -6
  81. package/dist/src/IO/FileSystem.js.map +1 -1
  82. package/dist/src/IO/Output.d.ts.map +1 -1
  83. package/dist/src/IO/Output.js.map +1 -1
  84. package/dist/src/Reporters/ConsoleReporter.d.ts.map +1 -1
  85. package/dist/src/Reporters/ConsoleReporter.js +8 -7
  86. package/dist/src/Reporters/ConsoleReporter.js.map +1 -1
  87. package/dist/src/Reporters/FileReporter.d.ts.map +1 -1
  88. package/dist/src/Reporters/FileReporter.js +1 -0
  89. package/dist/src/Reporters/FileReporter.js.map +1 -1
  90. package/dist/src/Reporters/JUnitReporter.d.ts +2 -2
  91. package/dist/src/Reporters/JUnitReporter.d.ts.map +1 -1
  92. package/dist/src/Reporters/JUnitReporter.js +7 -7
  93. package/dist/src/Reporters/JUnitReporter.js.map +1 -1
  94. package/dist/src/Reporters/ResultReporter.d.ts +3 -3
  95. package/dist/src/Reporters/ResultReporter.d.ts.map +1 -1
  96. package/dist/src/Reporters/SonarReporter.d.ts +2 -2
  97. package/dist/src/Reporters/SonarReporter.d.ts.map +1 -1
  98. package/dist/src/Reporters/SonarReporter.js +16 -16
  99. package/dist/src/Reporters/SonarReporter.js.map +1 -1
  100. package/dist/src/Reporters/XMLReporter.d.ts.map +1 -1
  101. package/dist/src/Reporters/XMLReporter.js.map +1 -1
  102. package/dist/src/Runners/Runner.d.ts +3 -3
  103. package/dist/src/Runners/Runner.d.ts.map +1 -1
  104. package/dist/src/Runners/Runner.js +8 -8
  105. package/dist/src/Runners/Runner.js.map +1 -1
  106. package/dist/src/Runners/TestRunner.d.ts +4 -4
  107. package/dist/src/Runners/TestRunner.d.ts.map +1 -1
  108. package/dist/src/Runners/TestRunner.js +4 -4
  109. package/dist/src/Runners/TestRunner.js.map +1 -1
  110. package/dist/src/Runners/TestSuiteLoader.d.ts +4 -4
  111. package/dist/src/Runners/TestSuiteLoader.d.ts.map +1 -1
  112. package/dist/src/Runners/TestSuiteLoader.js +21 -18
  113. package/dist/src/Runners/TestSuiteLoader.js.map +1 -1
  114. package/dist/src/Runners/TestSuiteRunner.d.ts +6 -6
  115. package/dist/src/Runners/TestSuiteRunner.d.ts.map +1 -1
  116. package/dist/src/Runners/TestSuiteRunner.js +3 -3
  117. package/dist/src/Runners/TestSuiteRunner.js.map +1 -1
  118. package/dist/xunit.d.ts +3 -3
  119. package/dist/xunit.d.ts.map +1 -1
  120. package/dist/xunit.js.map +1 -1
  121. package/icon.svg +74 -75
  122. package/logo.svg +130 -130
  123. package/package.json +44 -37
  124. package/src/Assertions/Contains.ts +10 -10
  125. package/src/Assertions/Count.ts +11 -11
  126. package/src/Assertions/Defined.ts +11 -11
  127. package/src/Assertions/DoesNotContain.ts +11 -11
  128. package/src/Assertions/DoesNotThrow.ts +13 -13
  129. package/src/Assertions/Empty.ts +11 -11
  130. package/src/Assertions/Equal.ts +12 -12
  131. package/src/Assertions/False.ts +11 -11
  132. package/src/Assertions/InstanceOf.ts +13 -13
  133. package/src/Assertions/NotEmpty.ts +11 -11
  134. package/src/Assertions/NotEqual.ts +12 -12
  135. package/src/Assertions/NotNull.ts +11 -11
  136. package/src/Assertions/Null.ts +11 -11
  137. package/src/Assertions/StringContains.ts +11 -11
  138. package/src/Assertions/StringDoesNotContain.ts +12 -12
  139. package/src/Assertions/StringDoesNotEndWith.ts +13 -13
  140. package/src/Assertions/StringDoesNotStartWith.ts +12 -12
  141. package/src/Assertions/StringEndsWith.ts +13 -13
  142. package/src/Assertions/StringStartsWith.ts +12 -12
  143. package/src/Assertions/Throws.ts +11 -11
  144. package/src/Assertions/True.ts +11 -11
  145. package/src/Assertions/Undefined.ts +12 -12
  146. package/src/Assertions/index.ts +45 -45
  147. package/src/CLI.ts +96 -85
  148. package/src/Factory.ts +25 -25
  149. package/src/Framework/ResultType.ts +4 -4
  150. package/src/Framework/Test.ts +6 -6
  151. package/src/Framework/TestName.ts +7 -7
  152. package/src/Framework/TestResult.ts +3 -2
  153. package/src/Framework/TestSuite.ts +29 -18
  154. package/src/Framework/TestSuiteResults.ts +17 -16
  155. package/src/IO/FileSystem.ts +28 -29
  156. package/src/IO/Output.ts +21 -20
  157. package/src/Reporters/ConsoleReporter.ts +88 -87
  158. package/src/Reporters/FileReporter.ts +29 -29
  159. package/src/Reporters/JUnitReporter.ts +80 -80
  160. package/src/Reporters/ResultReporter.ts +20 -12
  161. package/src/Reporters/SonarReporter.ts +86 -86
  162. package/src/Reporters/XMLReporter.ts +6 -6
  163. package/src/Runners/Runner.ts +21 -21
  164. package/src/Runners/TestRunner.ts +34 -33
  165. package/src/Runners/TestSuiteLoader.ts +52 -45
  166. package/src/Runners/TestSuiteRunner.ts +27 -26
  167. package/tsconfig.json +26 -26
  168. package/xunit.ts +6 -6
@@ -1,14 +1,14 @@
1
1
  import { AssertionError } from "assert";
2
- import equal from 'lodash.isequal';
2
+ import equal from "lodash.isequal";
3
3
 
4
4
  /**
5
5
  * Asserts that two values are equal
6
- *
6
+ *
7
7
  * @remarks
8
8
  * Passes if `actual` and `expected` evaluate to equal values
9
- *
9
+ *
10
10
  * Fails if `actual` and `expected` do not evaluate to equal values
11
- *
11
+ *
12
12
  * @param expected the expected value
13
13
  * @param actual the actual value
14
14
  * @param message (optional) message to display on failure
@@ -17,13 +17,13 @@ import equal from 'lodash.isequal';
17
17
  * this.assert.equal(expected, actual);
18
18
  */
19
19
  export default function Equal(expected: any, actual: any, message?: string) {
20
- if(equal(actual, expected)) {
21
- return;
22
- }
20
+ if (equal(actual, expected)) {
21
+ return;
22
+ }
23
23
 
24
- throw new AssertionError({
25
- message: message || 'Expected expressions to be equal, but expressions are not equal',
26
- expected: expected,
27
- actual: actual,
28
- });
24
+ throw new AssertionError({
25
+ message: message || "Expected expressions to be equal, but expressions are not equal",
26
+ expected: expected,
27
+ actual: actual,
28
+ });
29
29
  }
@@ -2,12 +2,12 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a given value is equal to `false`
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `expression` evaluates to `false`
8
- *
8
+ *
9
9
  * Fails if `expression` does not evaluate to `false`
10
- *
10
+ *
11
11
  * @param expression the value to check
12
12
  * @param message (optional) message to display on failure
13
13
  *
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * this.assert.false(expression);
16
16
  */
17
17
  export default function False(expression: any, message?: string) {
18
- if(expression === false) {
19
- return;
20
- }
18
+ if (expression === false) {
19
+ return;
20
+ }
21
21
 
22
- throw new AssertionError({
23
- message: message || 'Expected expression to be false, but expression is not false',
24
- expected: false,
25
- actual: expression
26
- });
22
+ throw new AssertionError({
23
+ message: message || "Expected expression to be false, but expression is not false",
24
+ expected: false,
25
+ actual: expression
26
+ });
27
27
  }
@@ -2,27 +2,27 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a value is an instance of a certain type
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `object`'s type matches `type`
8
- *
9
- * Fails if `object`'s type does not match `type`
8
+ *
9
+ * Fails if `object`'s type does not match `type`
10
10
  *
11
11
  * @param type the expected type of the value
12
12
  * @param expression the value to check
13
13
  * @param message (optional) message to display on failure
14
- *
14
+ *
15
15
  * @example
16
16
  * this.assert.instanceOf(type, object);
17
17
  */
18
- export default function InstanceOf<T>(type: any, expression: any, message?: string) {
19
- if (expression instanceof type) {
20
- return;
21
- }
18
+ export default function InstanceOf(type: any, expression: any, message?: string) {
19
+ if (expression instanceof type) {
20
+ return;
21
+ }
22
22
 
23
- throw new AssertionError({
24
- message: message || `Expected expression of type, but was ${typeof expression}`,
25
- expected: type,
26
- actual: typeof expression
27
- })
23
+ throw new AssertionError({
24
+ message: message || `Expected expression of type, but was ${typeof expression}`,
25
+ expected: type.name,
26
+ actual: typeof expression
27
+ });
28
28
  }
@@ -2,26 +2,26 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an array is not empty
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `array` contains any elements
8
- *
8
+ *
9
9
  * Fails if `array` contains zero elements
10
10
  *
11
11
  * @param array the array to check
12
12
  * @param message (optional) message to display on failure
13
- *
13
+ *
14
14
  * @example
15
15
  * this.assert.notEmpty(array);
16
16
  */
17
17
  export default function NotEmpty(array: ReadonlyArray<any>, message?: string) {
18
- if(array.length > 0) {
19
- return;
20
- }
18
+ if (array.length > 0) {
19
+ return;
20
+ }
21
21
 
22
- throw new AssertionError({
23
- message: message || 'Expected expression to be not empty, but expression was empty',
24
- expected: '(non-empty expression)',
25
- actual: array
26
- })
22
+ throw new AssertionError({
23
+ message: message || "Expected expression to be not empty, but expression was empty",
24
+ expected: "(non-empty expression)",
25
+ actual: array
26
+ });
27
27
  }
@@ -1,14 +1,14 @@
1
1
  import { AssertionError } from "assert";
2
- import equal from 'lodash.isequal';
2
+ import equal from "lodash.isequal";
3
3
 
4
4
  /**
5
5
  * Asserts that two values are not equal
6
- *
6
+ *
7
7
  * @remarks
8
8
  * Passes if `actual` and `expected` do not evaluate to equal values
9
- *
9
+ *
10
10
  * Fails if `actual` and `expected` evaluate to equal values
11
- *
11
+ *
12
12
  * @param expected the expected value
13
13
  * @param actual the actual value
14
14
  * @param message (optional) message to display on failure
@@ -17,13 +17,13 @@ import equal from 'lodash.isequal';
17
17
  * this.assert.notEqual(expected, actual);
18
18
  */
19
19
  export default function NotEqual(expected: any, actual: any, message?: string) {
20
- if(!equal(actual, expected)) {
21
- return;
22
- }
20
+ if (!equal(actual, expected)) {
21
+ return;
22
+ }
23
23
 
24
- throw new AssertionError({
25
- message: message || 'Expected expressions to be not equal, but expressions are equal',
26
- expected: expected,
27
- actual: actual,
28
- });
24
+ throw new AssertionError({
25
+ message: message || "Expected expressions to be not equal, but expressions are equal",
26
+ expected: expected,
27
+ actual: actual,
28
+ });
29
29
  }
@@ -2,12 +2,12 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a value is not `null`
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `expression` does not evaluate to `null`
8
- *
8
+ *
9
9
  * Fails if `expression` evaluates to `null`
10
- *
10
+ *
11
11
  * @param expression the value to check
12
12
  * @param message (optional) message to display on failure
13
13
  *
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * this.assert.notNull(expression);
16
16
  */
17
17
  export default function NotNull(expression: any, message?: string) {
18
- if(expression !== null) {
19
- return;
20
- }
18
+ if (expression !== null) {
19
+ return;
20
+ }
21
21
 
22
- throw new AssertionError({
23
- message: message || 'Expected expression to be not null, but expression is null',
24
- expected: '(non-null expression)',
25
- actual: expression
26
- });
22
+ throw new AssertionError({
23
+ message: message || "Expected expression to be not null, but expression is null",
24
+ expected: "(non-null expression)",
25
+ actual: expression
26
+ });
27
27
  }
@@ -2,12 +2,12 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a value is `null`
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `expression` evaluates to `null`
8
- *
8
+ *
9
9
  * Fails if `expression` does not evaluate to `null`
10
- *
10
+ *
11
11
  * @param expression the value to check
12
12
  * @param message (optional) message to display on failure
13
13
  *
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * this.assert.null(expression);
16
16
  */
17
17
  export default function Null(expression: any, message?: string) {
18
- if(expression === null) {
19
- return;
20
- }
18
+ if (expression === null) {
19
+ return;
20
+ }
21
21
 
22
- throw new AssertionError({
23
- message: message || 'Expected expression to be null, but expression is not null',
24
- expected: null,
25
- actual: expression
26
- });
22
+ throw new AssertionError({
23
+ message: message || "Expected expression to be null, but expression is not null",
24
+ expected: null,
25
+ actual: expression
26
+ });
27
27
  }
@@ -2,27 +2,27 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string contains a given substring
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `needle` is a substring of `haystack`
8
- *
8
+ *
9
9
  * Fails if `needle` is not a substring of `haystack`
10
10
  *
11
11
  * @param needle the substring to find
12
12
  * @param haystack the string to search
13
13
  * @param message (optional) message to display on failure
14
- *
14
+ *
15
15
  * @example
16
16
  * this.assert.stringContains(needle, haystack);
17
17
  */
18
18
  export default function StringContains(needle: string, haystack: string | null, message?: string) {
19
- if (haystack !== undefined && haystack !== null && haystack.indexOf(needle) > -1) {
20
- return;
21
- }
19
+ if (haystack !== undefined && haystack !== null && haystack.indexOf(needle) > -1) {
20
+ return;
21
+ }
22
22
 
23
- throw new AssertionError({
24
- message: message || 'Expected string containing expression, but string did not contain expression',
25
- expected: needle,
26
- actual: haystack
27
- });
23
+ throw new AssertionError({
24
+ message: message || "Expected string containing expression, but string did not contain expression",
25
+ expected: needle,
26
+ actual: haystack
27
+ });
28
28
  }
@@ -2,27 +2,27 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string does not contain a given substring
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `needle` is not a substring of `haystack`
8
- *
8
+ *
9
9
  * Fails if `needle` is a substring of `haystack`
10
10
  *
11
11
  * @param needle the substring to find
12
12
  * @param haystack the string to search
13
13
  * @param message (optional) message to display on failure
14
- *
14
+ *
15
15
  * @example
16
16
  * this.assert.stringDoesNotContain(needle, haystack);
17
17
  */
18
- export default function StringDoesNotContain(needle: string, haystack: string|null, message?: string) {
19
- if(haystack === undefined || haystack === null || haystack.indexOf(needle) === -1) {
20
- return;
21
- }
18
+ export default function StringDoesNotContain(needle: string, haystack: string | null, message?: string) {
19
+ if (haystack === undefined || haystack === null || haystack.indexOf(needle) === -1) {
20
+ return;
21
+ }
22
22
 
23
- throw new AssertionError({
24
- message: message || 'Expected string not containing expression, but string did contain expression',
25
- expected: needle,
26
- actual: haystack
27
- });
23
+ throw new AssertionError({
24
+ message: message || "Expected string not containing expression, but string did contain expression",
25
+ expected: needle,
26
+ actual: haystack
27
+ });
28
28
  }
@@ -2,29 +2,29 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string does not end with a given substring
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if the final characters of `haystack` do not match `needle`
8
- *
8
+ *
9
9
  * Fails if the final characters of `haystack` match `needle`
10
10
  *
11
11
  * @param needle the substring to find
12
12
  * @param haystack the string to search
13
13
  * @param message (optional) message to display on failure
14
- *
14
+ *
15
15
  * @example
16
16
  * this.assert.stringDoesNotEndWith(needle, haystack);
17
17
  */
18
18
  export default function StringDoesNotEndWith(needle: string, haystack: string | null, message?: string) {
19
- if (haystack === undefined || haystack === null
20
- || haystack.indexOf(needle) === -1
21
- || haystack.indexOf(needle) !== haystack.length - needle.length) {
22
- return;
23
- }
19
+ if (haystack === undefined || haystack === null
20
+ || haystack.indexOf(needle) === -1
21
+ || haystack.indexOf(needle) !== haystack.length - needle.length) {
22
+ return;
23
+ }
24
24
 
25
- throw new AssertionError({
26
- message: message || 'Expected string containing expression, but string did not contain expression',
27
- expected: needle,
28
- actual: haystack
29
- });
25
+ throw new AssertionError({
26
+ message: message || "Expected string containing expression, but string did not contain expression",
27
+ expected: needle,
28
+ actual: haystack
29
+ });
30
30
  }
@@ -2,27 +2,27 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string does not begin with a given substring
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if the first characters of `haystack` do not match `needle`
8
- *
8
+ *
9
9
  * Fails if the first characters of `haystack` match `needle`
10
10
  *
11
11
  * @param needle the substring to find
12
12
  * @param haystack the string to search
13
13
  * @param message (optional) message to display on failure
14
- *
14
+ *
15
15
  * @example
16
16
  * this.assert.stringDoesNotStartWith(needle, haystack);
17
17
  */
18
- export default function StringDoesNotStartWith(needle: string, haystack: string|null, message?: string) {
19
- if(haystack === undefined || haystack === null || haystack.indexOf(needle) !== 0) {
20
- return;
21
- }
18
+ export default function StringDoesNotStartWith(needle: string, haystack: string | null, message?: string) {
19
+ if (haystack === undefined || haystack === null || haystack.indexOf(needle) !== 0) {
20
+ return;
21
+ }
22
22
 
23
- throw new AssertionError({
24
- message: message || 'Expected string containing expression, but string did not contain expression',
25
- expected: needle,
26
- actual: haystack
27
- });
23
+ throw new AssertionError({
24
+ message: message || "Expected string containing expression, but string did not contain expression",
25
+ expected: needle,
26
+ actual: haystack
27
+ });
28
28
  }
@@ -2,29 +2,29 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string ends with a given substring
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if the final characters of `haystack` match `needle`
8
- *
8
+ *
9
9
  * Fails if the final characters of `haystack` do not match `needle`
10
10
  *
11
11
  * @param needle the substring to find
12
12
  * @param haystack the string to search
13
13
  * @param message (optional) message to display on failure
14
- *
14
+ *
15
15
  * @example
16
16
  * this.assert.stringEndsWith(needle, haystack);
17
17
  */
18
18
  export default function StringEndsWith(needle: string, haystack: string | null, message?: string) {
19
- if (haystack !== undefined && haystack !== null
20
- && haystack.indexOf(needle) > -1
21
- && haystack.indexOf(needle) === haystack.length - needle.length) {
22
- return;
23
- }
19
+ if (haystack !== undefined && haystack !== null
20
+ && haystack.indexOf(needle) > -1
21
+ && haystack.indexOf(needle) === haystack.length - needle.length) {
22
+ return;
23
+ }
24
24
 
25
- throw new AssertionError({
26
- message: message || 'Expected string containing expression, but string did not contain expression',
27
- expected: needle,
28
- actual: haystack
29
- });
25
+ throw new AssertionError({
26
+ message: message || "Expected string containing expression, but string did not contain expression",
27
+ expected: needle,
28
+ actual: haystack
29
+ });
30
30
  }
@@ -2,27 +2,27 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string begins with a given substring
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if the first characters of `haystack` match `needle`
8
- *
8
+ *
9
9
  * Fails if the first characters of `haystack` do not match `needle`
10
10
  *
11
11
  * @param needle the substring to find
12
12
  * @param haystack the string to search
13
13
  * @param message (optional) message to display on failure
14
- *
14
+ *
15
15
  * @example
16
16
  * this.assert.stringStartsWith(needle, haystack);
17
17
  */
18
- export default function StringStartsWith(needle: string, haystack: string|null, message?: string) {
19
- if(haystack !== undefined && haystack !== null && haystack.indexOf(needle) === 0) {
20
- return;
21
- }
18
+ export default function StringStartsWith(needle: string, haystack: string | null, message?: string) {
19
+ if (haystack !== undefined && haystack !== null && haystack.indexOf(needle) === 0) {
20
+ return;
21
+ }
22
22
 
23
- throw new AssertionError({
24
- message: message || 'Expected string containing expression, but string did not contain expression',
25
- expected: needle,
26
- actual: haystack
27
- });
23
+ throw new AssertionError({
24
+ message: message || "Expected string containing expression, but string did not contain expression",
25
+ expected: needle,
26
+ actual: haystack
27
+ });
28
28
  }
@@ -2,26 +2,26 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an expression throws an error/exception
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if calling `expression` throws an error/exception
8
- *
8
+ *
9
9
  * Fails if calling `expression` does not throw an error/exception
10
10
  *
11
11
  * @param expression the expression to run
12
12
  * @param message (optional) message to display on failure
13
- *
13
+ *
14
14
  * @example
15
15
  * this.assert.throws(() => expression);
16
16
  */
17
17
  export default function Throws(expression: () => any, message?: string) {
18
- try {
19
- expression();
20
- } catch (exception) {
21
- return;
22
- }
18
+ try {
19
+ expression();
20
+ } catch (exception) {
21
+ return;
22
+ }
23
23
 
24
- throw new AssertionError({
25
- message: message || 'Expected expression to throw exception, but expression did not throw exception'
26
- });
24
+ throw new AssertionError({
25
+ message: message || "Expected expression to throw exception, but expression did not throw exception"
26
+ });
27
27
  }
@@ -2,12 +2,12 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a given expression evaluates to `true`
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `expression` evaluates to `true`
8
- *
8
+ *
9
9
  * Fails if `expression` does not evaluate to `true`
10
- *
10
+ *
11
11
  * @param expression the value to check
12
12
  * @param message (optional) message to display on failure
13
13
  *
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * this.assert.true(expression);
16
16
  */
17
17
  export default function True(expression: any, message?: string) {
18
- if(expression === true) {
19
- return;
20
- }
18
+ if (expression === true) {
19
+ return;
20
+ }
21
21
 
22
- throw new AssertionError({
23
- message: message || 'Expected expression to be true, but expression is not true',
24
- expected: true,
25
- actual: expression
26
- });
22
+ throw new AssertionError({
23
+ message: message || "Expected expression to be true, but expression is not true",
24
+ expected: true,
25
+ actual: expression
26
+ });
27
27
  }
@@ -2,26 +2,26 @@ import { AssertionError } from "assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a given value is equal to `undefined`
5
- *
5
+ *
6
6
  * @remarks
7
7
  * Passes if `expression` evaluates to `undefined`
8
- *
8
+ *
9
9
  * Fails if `expression` does not evaluate to `undefined`
10
- *
10
+ *
11
11
  * @param expression the value to check
12
12
  * @param message (optional) message to display on failure
13
- *
13
+ *
14
14
  * @example
15
15
  * this.assert.undefined(expression);
16
16
  */
17
17
  export default function Undefined(expression: any, message?: string) {
18
- if(expression === undefined) {
19
- return;
20
- }
18
+ if (expression === undefined) {
19
+ return;
20
+ }
21
21
 
22
- throw new AssertionError({
23
- message: message || 'Expected expression to be undefined, but expression is not undefined',
24
- expected: undefined,
25
- actual: expression
26
- });
22
+ throw new AssertionError({
23
+ message: message || "Expected expression to be undefined, but expression is not undefined",
24
+ expected: undefined,
25
+ actual: expression
26
+ });
27
27
  }