xunit.ts 1.4.0 → 3.0.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 (214) hide show
  1. package/README.md +44 -19
  2. package/cli.ts +9 -4
  3. package/dist/cli.js +4 -4
  4. package/dist/cli.js.map +1 -1
  5. package/dist/eslint.config.d.ts +3 -0
  6. package/dist/eslint.config.d.ts.map +1 -0
  7. package/dist/eslint.config.js +46 -0
  8. package/dist/eslint.config.js.map +1 -0
  9. package/dist/src/Assertions/Contains.d.ts +1 -1
  10. package/dist/src/Assertions/Contains.d.ts.map +1 -1
  11. package/dist/src/Assertions/Contains.js +4 -4
  12. package/dist/src/Assertions/Contains.js.map +1 -1
  13. package/dist/src/Assertions/Count.d.ts +1 -1
  14. package/dist/src/Assertions/Count.d.ts.map +1 -1
  15. package/dist/src/Assertions/Count.js +4 -4
  16. package/dist/src/Assertions/Count.js.map +1 -1
  17. package/dist/src/Assertions/Defined.d.ts +1 -1
  18. package/dist/src/Assertions/Defined.d.ts.map +1 -1
  19. package/dist/src/Assertions/Defined.js +4 -4
  20. package/dist/src/Assertions/Defined.js.map +1 -1
  21. package/dist/src/Assertions/DoesNotContain.d.ts +1 -1
  22. package/dist/src/Assertions/DoesNotContain.d.ts.map +1 -1
  23. package/dist/src/Assertions/DoesNotContain.js +4 -4
  24. package/dist/src/Assertions/DoesNotContain.js.map +1 -1
  25. package/dist/src/Assertions/DoesNotThrow.d.ts +1 -1
  26. package/dist/src/Assertions/DoesNotThrow.d.ts.map +1 -1
  27. package/dist/src/Assertions/DoesNotThrow.js +4 -4
  28. package/dist/src/Assertions/DoesNotThrow.js.map +1 -1
  29. package/dist/src/Assertions/Empty.d.ts +1 -1
  30. package/dist/src/Assertions/Empty.d.ts.map +1 -1
  31. package/dist/src/Assertions/Empty.js +4 -4
  32. package/dist/src/Assertions/Empty.js.map +1 -1
  33. package/dist/src/Assertions/Equal.d.ts +1 -1
  34. package/dist/src/Assertions/Equal.d.ts.map +1 -1
  35. package/dist/src/Assertions/Equal.js +4 -4
  36. package/dist/src/Assertions/Equal.js.map +1 -1
  37. package/dist/src/Assertions/False.d.ts +1 -1
  38. package/dist/src/Assertions/False.d.ts.map +1 -1
  39. package/dist/src/Assertions/False.js +4 -4
  40. package/dist/src/Assertions/False.js.map +1 -1
  41. package/dist/src/Assertions/InstanceOf.d.ts +1 -1
  42. package/dist/src/Assertions/InstanceOf.d.ts.map +1 -1
  43. package/dist/src/Assertions/InstanceOf.js +4 -4
  44. package/dist/src/Assertions/InstanceOf.js.map +1 -1
  45. package/dist/src/Assertions/NotEmpty.d.ts +1 -1
  46. package/dist/src/Assertions/NotEmpty.d.ts.map +1 -1
  47. package/dist/src/Assertions/NotEmpty.js +4 -4
  48. package/dist/src/Assertions/NotEmpty.js.map +1 -1
  49. package/dist/src/Assertions/NotEqual.d.ts +1 -1
  50. package/dist/src/Assertions/NotEqual.d.ts.map +1 -1
  51. package/dist/src/Assertions/NotEqual.js +4 -4
  52. package/dist/src/Assertions/NotEqual.js.map +1 -1
  53. package/dist/src/Assertions/NotNull.d.ts +1 -1
  54. package/dist/src/Assertions/NotNull.d.ts.map +1 -1
  55. package/dist/src/Assertions/NotNull.js +4 -4
  56. package/dist/src/Assertions/NotNull.js.map +1 -1
  57. package/dist/src/Assertions/Null.d.ts +1 -1
  58. package/dist/src/Assertions/Null.d.ts.map +1 -1
  59. package/dist/src/Assertions/Null.js +4 -4
  60. package/dist/src/Assertions/Null.js.map +1 -1
  61. package/dist/src/Assertions/StringContains.js +5 -5
  62. package/dist/src/Assertions/StringContains.js.map +1 -1
  63. package/dist/src/Assertions/StringDoesNotContain.js +5 -5
  64. package/dist/src/Assertions/StringDoesNotContain.js.map +1 -1
  65. package/dist/src/Assertions/StringDoesNotEndWith.d.ts.map +1 -1
  66. package/dist/src/Assertions/StringDoesNotEndWith.js +5 -7
  67. package/dist/src/Assertions/StringDoesNotEndWith.js.map +1 -1
  68. package/dist/src/Assertions/StringDoesNotMatch.d.ts +17 -0
  69. package/dist/src/Assertions/StringDoesNotMatch.d.ts.map +1 -0
  70. package/dist/src/Assertions/StringDoesNotMatch.js +30 -0
  71. package/dist/src/Assertions/StringDoesNotMatch.js.map +1 -0
  72. package/dist/src/Assertions/StringDoesNotStartWith.js +5 -5
  73. package/dist/src/Assertions/StringDoesNotStartWith.js.map +1 -1
  74. package/dist/src/Assertions/StringEndsWith.d.ts.map +1 -1
  75. package/dist/src/Assertions/StringEndsWith.js +5 -7
  76. package/dist/src/Assertions/StringEndsWith.js.map +1 -1
  77. package/dist/src/Assertions/StringMatches.d.ts +17 -0
  78. package/dist/src/Assertions/StringMatches.d.ts.map +1 -0
  79. package/dist/src/Assertions/StringMatches.js +30 -0
  80. package/dist/src/Assertions/StringMatches.js.map +1 -0
  81. package/dist/src/Assertions/StringStartsWith.js +5 -5
  82. package/dist/src/Assertions/StringStartsWith.js.map +1 -1
  83. package/dist/src/Assertions/Throws.d.ts +1 -1
  84. package/dist/src/Assertions/Throws.d.ts.map +1 -1
  85. package/dist/src/Assertions/Throws.js +5 -5
  86. package/dist/src/Assertions/Throws.js.map +1 -1
  87. package/dist/src/Assertions/True.d.ts +1 -1
  88. package/dist/src/Assertions/True.d.ts.map +1 -1
  89. package/dist/src/Assertions/True.js +4 -4
  90. package/dist/src/Assertions/True.js.map +1 -1
  91. package/dist/src/Assertions/Undefined.d.ts +1 -1
  92. package/dist/src/Assertions/Undefined.d.ts.map +1 -1
  93. package/dist/src/Assertions/Undefined.js +4 -4
  94. package/dist/src/Assertions/Undefined.js.map +1 -1
  95. package/dist/src/Assertions/index.d.ts +18 -14
  96. package/dist/src/Assertions/index.d.ts.map +1 -1
  97. package/dist/src/Assertions/index.js +18 -14
  98. package/dist/src/Assertions/index.js.map +1 -1
  99. package/dist/src/CLI.d.ts +1 -3
  100. package/dist/src/CLI.d.ts.map +1 -1
  101. package/dist/src/CLI.js +9 -7
  102. package/dist/src/CLI.js.map +1 -1
  103. package/dist/src/Factory.d.ts +1 -1
  104. package/dist/src/Factory.d.ts.map +1 -1
  105. package/dist/src/Factory.js +7 -7
  106. package/dist/src/Factory.js.map +1 -1
  107. package/dist/src/Framework/ResultType.js +1 -1
  108. package/dist/src/Framework/ResultType.js.map +1 -1
  109. package/dist/src/Framework/Test.d.ts +1 -1
  110. package/dist/src/Framework/Test.d.ts.map +1 -1
  111. package/dist/src/Framework/Test.js +2 -2
  112. package/dist/src/Framework/Test.js.map +1 -1
  113. package/dist/src/Framework/TestInfo.d.ts +5 -1
  114. package/dist/src/Framework/TestInfo.d.ts.map +1 -1
  115. package/dist/src/Framework/TestName.js +2 -2
  116. package/dist/src/Framework/TestName.js.map +1 -1
  117. package/dist/src/Framework/TestSuite.d.ts +4 -2
  118. package/dist/src/Framework/TestSuite.d.ts.map +1 -1
  119. package/dist/src/Framework/TestSuite.js +8 -5
  120. package/dist/src/Framework/TestSuite.js.map +1 -1
  121. package/dist/src/IO/FileSystem.d.ts +2 -2
  122. package/dist/src/IO/FileSystem.d.ts.map +1 -1
  123. package/dist/src/IO/FileSystem.js +6 -5
  124. package/dist/src/IO/FileSystem.js.map +1 -1
  125. package/dist/src/IO/Output.d.ts +1 -2
  126. package/dist/src/IO/Output.d.ts.map +1 -1
  127. package/dist/src/IO/Output.js.map +1 -1
  128. package/dist/src/Reporters/ConsoleReporter.d.ts +4 -5
  129. package/dist/src/Reporters/ConsoleReporter.d.ts.map +1 -1
  130. package/dist/src/Reporters/ConsoleReporter.js +39 -28
  131. package/dist/src/Reporters/ConsoleReporter.js.map +1 -1
  132. package/dist/src/Reporters/FileReporter.d.ts +4 -5
  133. package/dist/src/Reporters/FileReporter.d.ts.map +1 -1
  134. package/dist/src/Reporters/FileReporter.js +0 -1
  135. package/dist/src/Reporters/FileReporter.js.map +1 -1
  136. package/dist/src/Reporters/JUnitReporter.d.ts.map +1 -1
  137. package/dist/src/Reporters/JUnitReporter.js +1 -1
  138. package/dist/src/Reporters/JUnitReporter.js.map +1 -1
  139. package/dist/src/Reporters/ResultReporter.d.ts +2 -3
  140. package/dist/src/Reporters/ResultReporter.d.ts.map +1 -1
  141. package/dist/src/Reporters/ResultReporter.js +1 -0
  142. package/dist/src/Reporters/ResultReporter.js.map +1 -1
  143. package/dist/src/Reporters/SonarReporter.d.ts.map +1 -1
  144. package/dist/src/Reporters/SonarReporter.js +2 -2
  145. package/dist/src/Reporters/SonarReporter.js.map +1 -1
  146. package/dist/src/Reporters/XMLReporter.d.ts +1 -1
  147. package/dist/src/Reporters/XMLReporter.d.ts.map +1 -1
  148. package/dist/src/Reporters/XMLReporter.js.map +1 -1
  149. package/dist/src/Runners/Runner.d.ts +3 -3
  150. package/dist/src/Runners/Runner.d.ts.map +1 -1
  151. package/dist/src/Runners/Runner.js +1 -1
  152. package/dist/src/Runners/Runner.js.map +1 -1
  153. package/dist/src/Runners/TestRunner.d.ts +4 -2
  154. package/dist/src/Runners/TestRunner.d.ts.map +1 -1
  155. package/dist/src/Runners/TestRunner.js +13 -8
  156. package/dist/src/Runners/TestRunner.js.map +1 -1
  157. package/dist/src/Runners/TestSuiteLoader.d.ts.map +1 -1
  158. package/dist/src/Runners/TestSuiteLoader.js +32 -18
  159. package/dist/src/Runners/TestSuiteLoader.js.map +1 -1
  160. package/dist/src/Runners/TestSuiteRunner.d.ts +4 -4
  161. package/dist/src/Runners/TestSuiteRunner.d.ts.map +1 -1
  162. package/dist/src/Runners/TestSuiteRunner.js +3 -3
  163. package/dist/src/Runners/TestSuiteRunner.js.map +1 -1
  164. package/dist/xunit.d.ts +2 -2
  165. package/dist/xunit.d.ts.map +1 -1
  166. package/dist/xunit.js +3 -3
  167. package/dist/xunit.js.map +1 -1
  168. package/eslint.config.ts +44 -0
  169. package/package.json +18 -14
  170. package/src/Assertions/Contains.ts +3 -3
  171. package/src/Assertions/Count.ts +3 -3
  172. package/src/Assertions/Defined.ts +3 -3
  173. package/src/Assertions/DoesNotContain.ts +3 -3
  174. package/src/Assertions/DoesNotThrow.ts +3 -3
  175. package/src/Assertions/Empty.ts +3 -3
  176. package/src/Assertions/Equal.ts +4 -3
  177. package/src/Assertions/False.ts +3 -3
  178. package/src/Assertions/InstanceOf.ts +3 -3
  179. package/src/Assertions/NotEmpty.ts +3 -3
  180. package/src/Assertions/NotEqual.ts +4 -3
  181. package/src/Assertions/NotNull.ts +3 -3
  182. package/src/Assertions/Null.ts +3 -3
  183. package/src/Assertions/StringContains.ts +3 -3
  184. package/src/Assertions/StringDoesNotContain.ts +3 -3
  185. package/src/Assertions/StringDoesNotEndWith.ts +3 -5
  186. package/src/Assertions/StringDoesNotMatch.ts +28 -0
  187. package/src/Assertions/StringDoesNotStartWith.ts +3 -3
  188. package/src/Assertions/StringEndsWith.ts +3 -5
  189. package/src/Assertions/StringMatches.ts +28 -0
  190. package/src/Assertions/StringStartsWith.ts +3 -3
  191. package/src/Assertions/Throws.ts +4 -4
  192. package/src/Assertions/True.ts +3 -3
  193. package/src/Assertions/Undefined.ts +3 -3
  194. package/src/Assertions/index.ts +19 -25
  195. package/src/CLI.ts +11 -7
  196. package/src/Factory.ts +11 -9
  197. package/src/Framework/Test.ts +2 -2
  198. package/src/Framework/TestInfo.ts +7 -1
  199. package/src/Framework/TestName.ts +2 -2
  200. package/src/Framework/TestSuite.ts +12 -7
  201. package/src/IO/FileSystem.ts +7 -5
  202. package/src/IO/Output.ts +1 -1
  203. package/src/Reporters/ConsoleReporter.ts +14 -12
  204. package/src/Reporters/FileReporter.ts +7 -5
  205. package/src/Reporters/JUnitReporter.ts +3 -2
  206. package/src/Reporters/ResultReporter.ts +4 -3
  207. package/src/Reporters/SonarReporter.ts +4 -2
  208. package/src/Reporters/XMLReporter.ts +2 -2
  209. package/src/Runners/Runner.ts +5 -5
  210. package/src/Runners/TestRunner.ts +19 -11
  211. package/src/Runners/TestSuiteLoader.ts +14 -7
  212. package/src/Runners/TestSuiteRunner.ts +7 -7
  213. package/tsconfig.json +3 -0
  214. package/xunit.ts +3 -4
@@ -20,10 +20,10 @@ class TestSuiteRunner {
20
20
  }
21
21
  runSuite(suite, filters) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
- yield Promise.all(this.reporters.map(r => r.suiteStarted(suite)));
23
+ this.reporters.map(r => r.suiteStarted(suite));
24
24
  const tests = suite.getTests(filters);
25
25
  const results = yield this.runTests(suite, tests);
26
- yield Promise.all(this.reporters.map(r => r.suiteCompleted(suite, results)));
26
+ this.reporters.map(r => r.suiteCompleted(suite, results));
27
27
  return results;
28
28
  });
29
29
  }
@@ -31,7 +31,7 @@ class TestSuiteRunner {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
32
  const results = new TestSuiteResults_1.default(suite);
33
33
  if (tests === undefined || tests === null || Object.keys(tests).length === 0) {
34
- yield Promise.all(this.reporters.map(r => r.testIncomplete(suite, "(no tests found)")));
34
+ this.reporters.map(r => r.testIncomplete(suite, "(no tests found)"));
35
35
  return results;
36
36
  }
37
37
  const test_names = Object.keys(tests);
@@ -1 +1 @@
1
- {"version":3,"file":"TestSuiteRunner.js","sourceRoot":"","sources":["../../../src/Runners/TestSuiteRunner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,qFAA6D;AAI7D,MAAqB,eAAe;IAEnC,YAA6B,MAAkB,EAAmB,SAAwC;QAA7E,WAAM,GAAN,MAAM,CAAY;QAAmB,cAAS,GAAT,SAAS,CAA+B;IAC1G,CAAC;IAEK,QAAQ,CAAC,KAAgB,EAAE,OAAiB;;YACjD,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAClE,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAClD,MAAM,OAAO,CAAC,GAAG,CAA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AA5BD,kCA4BC"}
package/dist/xunit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import Assert from "./src/Assertions";
1
2
  import Test from "./src/Framework/Test";
2
3
  import TestSuite from "./src/Framework/TestSuite";
3
- import Assert from "./src/Assertions";
4
- export { Test, TestSuite, Assert };
4
+ export { Assert, Test, TestSuite };
5
5
  //# sourceMappingURL=xunit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xunit.d.ts","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,sBAAsB,CAAC;AACxC,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,MAAM,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EACN,IAAI,EACJ,SAAS,EACT,MAAM,EACN,CAAC"}
1
+ {"version":3,"file":"xunit.d.ts","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,IAAI,MAAM,sBAAsB,CAAC;AACxC,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAElD,OAAO,EACN,MAAM,EACN,IAAI,EACJ,SAAS,EAAE,CAAC"}
package/dist/xunit.js CHANGED
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Assert = exports.TestSuite = exports.Test = void 0;
6
+ exports.TestSuite = exports.Test = exports.Assert = void 0;
7
+ const Assertions_1 = __importDefault(require("./src/Assertions"));
8
+ exports.Assert = Assertions_1.default;
7
9
  const Test_1 = __importDefault(require("./src/Framework/Test"));
8
10
  exports.Test = Test_1.default;
9
11
  const TestSuite_1 = __importDefault(require("./src/Framework/TestSuite"));
10
12
  exports.TestSuite = TestSuite_1.default;
11
- const Assertions_1 = __importDefault(require("./src/Assertions"));
12
- exports.Assert = Assertions_1.default;
13
13
  //# sourceMappingURL=xunit.js.map
package/dist/xunit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"xunit.js","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAwC;AAKvC,eALM,cAAI,CAKN;AAJL,0EAAkD;AAKjD,oBALM,mBAAS,CAKN;AAJV,kEAAsC;AAKrC,iBALM,oBAAM,CAKN"}
1
+ {"version":3,"file":"xunit.js","sourceRoot":"","sources":["../xunit.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAsC;AAKrC,iBALM,oBAAM,CAKN;AAJP,gEAAwC;AAKvC,eALM,cAAI,CAKN;AAJL,0EAAkD;AAKjD,oBALM,mBAAS,CAKN"}
@@ -0,0 +1,44 @@
1
+ import js from "@eslint/js";
2
+ import stylistic from "@stylistic/eslint-plugin";
3
+ import { defineConfig } from "eslint/config";
4
+ import sort from "eslint-plugin-simple-import-sort";
5
+ import tseslint from "typescript-eslint";
6
+
7
+ export default defineConfig([
8
+ {
9
+ ignores: ["dist"]
10
+ },
11
+ {
12
+ languageOptions: {
13
+ parser: tseslint.parser,
14
+ parserOptions: { projectService: true }
15
+ },
16
+ plugins: {
17
+ "@stylistic": stylistic,
18
+ "simple-import-sort": sort
19
+ },
20
+ files: ["**/*.ts"],
21
+ extends: [
22
+ js.configs.recommended,
23
+ tseslint.configs.recommended,
24
+ tseslint.configs.strictTypeChecked,
25
+ tseslint.configs.stylisticTypeChecked
26
+ ],
27
+ rules: {
28
+ "indent": ["warn", "tab"],
29
+ "quotes": ["warn", "double"],
30
+
31
+ "simple-import-sort/imports": "warn",
32
+ "simple-import-sort/exports": "warn",
33
+ "sort-imports": "off",
34
+
35
+ "@stylistic/object-curly-spacing": ["warn", "always"],
36
+ "@stylistic/semi": ["error", "always"],
37
+
38
+ "@typescript-eslint/no-confusing-void-expression": "off",
39
+ "@typescript-eslint/no-extraneous-class": "off",
40
+ "@typescript-eslint/no-unsafe-function-type": "off",
41
+ "@typescript-eslint/restrict-template-expressions": "off"
42
+ }
43
+ }
44
+ ]);
package/package.json CHANGED
@@ -1,35 +1,39 @@
1
1
  {
2
2
  "name": "xunit.ts",
3
- "version": "1.4.0",
3
+ "version": "3.0.0",
4
4
  "description": "A unit testing framework for TypeScript, following standard xUnit patterns",
5
5
  "main": "dist/xunit.js",
6
6
  "author": "ecoAPM LLC",
7
7
  "homepage": "https://github.com/ecoAPM/xunit.ts",
8
+ "repository": "https://github.com/ecoAPM/xunit.ts",
8
9
  "bugs": "https://github.com/ecoAPM/xunit.ts/issues",
9
10
  "license": "MIT",
10
11
  "engines": {
11
- "node": ">= 14"
12
+ "node": ">= 24"
12
13
  },
13
14
  "dependencies": {
14
15
  "colors": "1.4.0",
15
- "command-line-args": "5.2.1",
16
- "command-line-usage": "7.0.1",
16
+ "command-line-args": "6.0.2",
17
+ "command-line-usage": "7.0.4",
17
18
  "lodash.escaperegexp": "4.1.2",
18
19
  "lodash.isequal": "4.5.0",
19
20
  "xml": "1.0.1"
20
21
  },
21
22
  "devDependencies": {
22
- "@types/command-line-args": "5.2.0",
23
- "@types/command-line-usage": "5.0.2",
24
- "@types/lodash.escaperegexp": "4.1.7",
25
- "@types/lodash.isequal": "4.5.6",
26
- "@types/node": "18.15.7",
27
- "@types/xml": "1.0.8",
28
- "@typescript-eslint/eslint-plugin": "5.56.0",
29
- "@typescript-eslint/parser": "5.56.0",
30
- "eslint": "8.36.0",
23
+ "@eslint/js": "10.0.1",
24
+ "@stylistic/eslint-plugin": "5.10.0",
25
+ "@types/command-line-args": "5.2.3",
26
+ "@types/command-line-usage": "5.0.4",
27
+ "@types/lodash.escaperegexp": "4.1.9",
28
+ "@types/lodash.isequal": "4.5.8",
29
+ "@types/node": "25.9.3",
30
+ "@types/xml": "1.0.11",
31
+ "eslint": "10.4.1",
32
+ "eslint-plugin-simple-import-sort": "^13.0.0",
33
+ "jiti": "2.7.0",
31
34
  "ts-mockito": "2.6.1",
32
- "typescript": "5.0.2"
35
+ "typescript": "6.0.3",
36
+ "typescript-eslint": "8.61.0"
33
37
  },
34
38
  "peerDependencies": {
35
39
  "typescript": ">= 4"
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an array contains a given element
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * @example
16
16
  * this.assert.contains(needle, haystack);
17
17
  */
18
- export default function Contains<T>(needle: T, haystack: ReadonlyArray<T>, message?: string) {
18
+ export default function Contains<T>(needle: T, haystack: readonly T[], message?: string) {
19
19
  if (haystack.includes(needle)) {
20
20
  return;
21
21
  }
22
22
 
23
23
  throw new AssertionError({
24
- message: message || "Expected array containing expression, but array did not contain expression",
24
+ message: message ?? "Expected array containing expression, but array did not contain expression",
25
25
  expected: needle,
26
26
  actual: haystack
27
27
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an array contains a certain number of elements
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * @example
16
16
  * this.assert.count(expected, array);
17
17
  */
18
- export default function Count(expected: number, array: ReadonlyArray<any>, message?: string) {
18
+ export default function Count(expected: number, array: readonly unknown[], message?: string) {
19
19
  if (array.length === expected) {
20
20
  return;
21
21
  }
22
22
 
23
23
  throw new AssertionError({
24
- message: message || `Expected array with ${expected} elements, but array had ${array.length} elements`,
24
+ message: message ?? `Expected array with ${expected} elements, but array had ${array.length} elements`,
25
25
  expected: expected,
26
26
  actual: array.length
27
27
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a value is defined (any value other than `undefined`)
@@ -14,13 +14,13 @@ import { AssertionError } from "assert";
14
14
  * @example
15
15
  * this.assert.defined(expression);
16
16
  */
17
- export default function Defined(expression: any, message?: string) {
17
+ export default function Defined(expression: unknown, message?: string) {
18
18
  if (expression !== undefined) {
19
19
  return;
20
20
  }
21
21
 
22
22
  throw new AssertionError({
23
- message: message || "Expected expression to be defined, but expression is undefined",
23
+ message: message ?? "Expected expression to be defined, but expression is undefined",
24
24
  expected: "(not undefined expression)",
25
25
  actual: expression
26
26
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an array does not contain a given element
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * @example
16
16
  * this.assert.doesNotContain(needle, haystack);
17
17
  */
18
- export default function DoesNotContain<T>(needle: T, haystack: ReadonlyArray<T>, message?: string) {
18
+ export default function DoesNotContain<T>(needle: T, haystack: readonly T[], message?: string) {
19
19
  if (!haystack.includes(needle)) {
20
20
  return;
21
21
  }
22
22
 
23
23
  throw new AssertionError({
24
- message: message || "Expected array not containing expression, but array contained expression",
24
+ message: message ?? "Expected array not containing expression, but array contained expression",
25
25
  expected: needle,
26
26
  actual: haystack
27
27
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an expression does not throw an error/exception
@@ -14,13 +14,13 @@ import { AssertionError } from "assert";
14
14
  * @example
15
15
  * this.assert.doesNotThrow(() => expression);
16
16
  */
17
- export default function DoesNotThrow(expression: () => any, message?: string) {
17
+ export default function DoesNotThrow(expression: () => unknown, message?: string) {
18
18
  try {
19
19
  expression();
20
20
  return;
21
21
  } catch (exception) {
22
22
  throw new AssertionError({
23
- message: message || "Expected expression to not throw exception, but expression did throw exception",
23
+ message: message ?? "Expected expression to not throw exception, but expression did throw exception",
24
24
  expected: "(no exception)",
25
25
  actual: exception
26
26
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an array is empty
@@ -14,13 +14,13 @@ import { AssertionError } from "assert";
14
14
  * @example
15
15
  * this.assert.empty(array);
16
16
  */
17
- export default function Empty(array: ReadonlyArray<any>, message?: string) {
17
+ export default function Empty(array: readonly unknown[], message?: string) {
18
18
  if (array.length === 0) {
19
19
  return;
20
20
  }
21
21
 
22
22
  throw new AssertionError({
23
- message: message || "Expected expression to be empty, but expression was not empty",
23
+ message: message ?? "Expected expression to be empty, but expression was not empty",
24
24
  expected: [],
25
25
  actual: array
26
26
  });
@@ -1,4 +1,5 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
+
2
3
  import equal from "lodash.isequal";
3
4
 
4
5
  /**
@@ -16,13 +17,13 @@ import equal from "lodash.isequal";
16
17
  * @example
17
18
  * this.assert.equal(expected, actual);
18
19
  */
19
- export default function Equal(expected: any, actual: any, message?: string) {
20
+ export default function Equal(expected: unknown, actual: unknown, message?: string) {
20
21
  if (equal(actual, expected)) {
21
22
  return;
22
23
  }
23
24
 
24
25
  throw new AssertionError({
25
- message: message || "Expected expressions to be equal, but expressions are not equal",
26
+ message: message ?? "Expected expressions to be equal, but expressions are not equal",
26
27
  expected: expected,
27
28
  actual: actual,
28
29
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a given value is equal to `false`
@@ -14,13 +14,13 @@ import { AssertionError } from "assert";
14
14
  * @example
15
15
  * this.assert.false(expression);
16
16
  */
17
- export default function False(expression: any, message?: string) {
17
+ export default function False(expression: unknown, message?: string) {
18
18
  if (expression === false) {
19
19
  return;
20
20
  }
21
21
 
22
22
  throw new AssertionError({
23
- message: message || "Expected expression to be false, but expression is not false",
23
+ message: message ?? "Expected expression to be false, but expression is not false",
24
24
  expected: false,
25
25
  actual: expression
26
26
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a value is an instance of a certain type
@@ -15,13 +15,13 @@ import { AssertionError } from "assert";
15
15
  * @example
16
16
  * this.assert.instanceOf(type, object);
17
17
  */
18
- export default function InstanceOf(type: any, expression: any, message?: string) {
18
+ export default function InstanceOf(type: Function, expression: unknown, message?: string) {
19
19
  if (expression instanceof type) {
20
20
  return;
21
21
  }
22
22
 
23
23
  throw new AssertionError({
24
- message: message || `Expected expression of type, but was ${typeof expression}`,
24
+ message: message ?? `Expected expression of type, but was ${typeof expression}`,
25
25
  expected: type.name,
26
26
  actual: typeof expression
27
27
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that an array is not empty
@@ -14,13 +14,13 @@ import { AssertionError } from "assert";
14
14
  * @example
15
15
  * this.assert.notEmpty(array);
16
16
  */
17
- export default function NotEmpty(array: ReadonlyArray<any>, message?: string) {
17
+ export default function NotEmpty(array: readonly unknown[], message?: string) {
18
18
  if (array.length > 0) {
19
19
  return;
20
20
  }
21
21
 
22
22
  throw new AssertionError({
23
- message: message || "Expected expression to be not empty, but expression was empty",
23
+ message: message ?? "Expected expression to be not empty, but expression was empty",
24
24
  expected: "(non-empty expression)",
25
25
  actual: array
26
26
  });
@@ -1,4 +1,5 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
+
2
3
  import equal from "lodash.isequal";
3
4
 
4
5
  /**
@@ -16,13 +17,13 @@ import equal from "lodash.isequal";
16
17
  * @example
17
18
  * this.assert.notEqual(expected, actual);
18
19
  */
19
- export default function NotEqual(expected: any, actual: any, message?: string) {
20
+ export default function NotEqual(expected: unknown, actual: unknown, message?: string) {
20
21
  if (!equal(actual, expected)) {
21
22
  return;
22
23
  }
23
24
 
24
25
  throw new AssertionError({
25
- message: message || "Expected expressions to be not equal, but expressions are equal",
26
+ message: message ?? "Expected expressions to be not equal, but expressions are equal",
26
27
  expected: expected,
27
28
  actual: actual,
28
29
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a value is not `null`
@@ -14,13 +14,13 @@ import { AssertionError } from "assert";
14
14
  * @example
15
15
  * this.assert.notNull(expression);
16
16
  */
17
- export default function NotNull(expression: any, message?: string) {
17
+ export default function NotNull(expression: unknown, message?: string) {
18
18
  if (expression !== null) {
19
19
  return;
20
20
  }
21
21
 
22
22
  throw new AssertionError({
23
- message: message || "Expected expression to be not null, but expression is null",
23
+ message: message ?? "Expected expression to be not null, but expression is null",
24
24
  expected: "(non-null expression)",
25
25
  actual: expression
26
26
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a value is `null`
@@ -14,13 +14,13 @@ import { AssertionError } from "assert";
14
14
  * @example
15
15
  * this.assert.null(expression);
16
16
  */
17
- export default function Null(expression: any, message?: string) {
17
+ export default function Null(expression: unknown, message?: string) {
18
18
  if (expression === null) {
19
19
  return;
20
20
  }
21
21
 
22
22
  throw new AssertionError({
23
- message: message || "Expected expression to be null, but expression is not null",
23
+ message: message ?? "Expected expression to be null, but expression is not null",
24
24
  expected: null,
25
25
  actual: expression
26
26
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string contains a given substring
@@ -16,12 +16,12 @@ import { AssertionError } from "assert";
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) {
19
+ if (haystack?.includes(needle)) {
20
20
  return;
21
21
  }
22
22
 
23
23
  throw new AssertionError({
24
- message: message || "Expected string containing expression, but string did not contain expression",
24
+ message: message ?? "Expected string containing expression, but string did not contain expression",
25
25
  expected: needle,
26
26
  actual: haystack
27
27
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string does not contain a given substring
@@ -16,12 +16,12 @@ import { AssertionError } from "assert";
16
16
  * this.assert.stringDoesNotContain(needle, haystack);
17
17
  */
18
18
  export default function StringDoesNotContain(needle: string, haystack: string | null, message?: string) {
19
- if (haystack === undefined || haystack === null || haystack.indexOf(needle) === -1) {
19
+ if (!haystack?.includes(needle)) {
20
20
  return;
21
21
  }
22
22
 
23
23
  throw new AssertionError({
24
- message: message || "Expected string not containing expression, but string did contain expression",
24
+ message: message ?? "Expected string not containing expression, but string did contain expression",
25
25
  expected: needle,
26
26
  actual: haystack
27
27
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string does not end with a given substring
@@ -16,14 +16,12 @@ import { AssertionError } from "assert";
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) {
19
+ if (!haystack?.endsWith(needle)) {
22
20
  return;
23
21
  }
24
22
 
25
23
  throw new AssertionError({
26
- message: message || "Expected string containing expression, but string did not contain expression",
24
+ message: message ?? "Expected string containing expression, but string did not contain expression",
27
25
  expected: needle,
28
26
  actual: haystack
29
27
  });
@@ -0,0 +1,28 @@
1
+ import { AssertionError } from "node:assert";
2
+
3
+ /**
4
+ * Asserts that a string does not match a given regular expression
5
+ *
6
+ * @remarks
7
+ * Passes if `haystack` does not pass a `regex` test
8
+ *
9
+ * Fails if `haystack` passes a `regex` test
10
+ *
11
+ * @param regex the regular expression to test
12
+ * @param haystack the string to search
13
+ * @param message (optional) message to display on failure
14
+ *
15
+ * @example
16
+ * this.assert.stringDoesNotMatch(regex, haystack);
17
+ */
18
+ export default function StringDoesNotMatch(regex: RegExp, haystack?: string | null, message?: string) {
19
+ if (haystack === undefined || haystack === null || !regex.test(haystack)) {
20
+ return;
21
+ }
22
+
23
+ throw new AssertionError({
24
+ message: message ?? "Expected string not pass regular expression test, but string did pass",
25
+ expected: regex.test(haystack),
26
+ actual: haystack
27
+ });
28
+ }
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string does not begin with a given substring
@@ -16,12 +16,12 @@ import { AssertionError } from "assert";
16
16
  * this.assert.stringDoesNotStartWith(needle, haystack);
17
17
  */
18
18
  export default function StringDoesNotStartWith(needle: string, haystack: string | null, message?: string) {
19
- if (haystack === undefined || haystack === null || haystack.indexOf(needle) !== 0) {
19
+ if (!haystack?.startsWith(needle)) {
20
20
  return;
21
21
  }
22
22
 
23
23
  throw new AssertionError({
24
- message: message || "Expected string containing expression, but string did not contain expression",
24
+ message: message ?? "Expected string containing expression, but string did not contain expression",
25
25
  expected: needle,
26
26
  actual: haystack
27
27
  });
@@ -1,4 +1,4 @@
1
- import { AssertionError } from "assert";
1
+ import { AssertionError } from "node:assert";
2
2
 
3
3
  /**
4
4
  * Asserts that a string ends with a given substring
@@ -16,14 +16,12 @@ import { AssertionError } from "assert";
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) {
19
+ if (haystack?.endsWith(needle)) {
22
20
  return;
23
21
  }
24
22
 
25
23
  throw new AssertionError({
26
- message: message || "Expected string containing expression, but string did not contain expression",
24
+ message: message ?? "Expected string containing expression, but string did not contain expression",
27
25
  expected: needle,
28
26
  actual: haystack
29
27
  });
@@ -0,0 +1,28 @@
1
+ import { AssertionError } from "node:assert";
2
+
3
+ /**
4
+ * Asserts that a string matches a given regular expression
5
+ *
6
+ * @remarks
7
+ * Passes if `haystack` matches a `regex` test
8
+ *
9
+ * Fails if `haystack` does not match a `regex` test
10
+ *
11
+ * @param regex the regular expression to match
12
+ * @param haystack the string to search
13
+ * @param message (optional) message to display on failure
14
+ *
15
+ * @example
16
+ * this.assert.stringMatches(regex, haystack);
17
+ */
18
+ export default function StringMatches(regex: RegExp, haystack?: string | null, message?: string) {
19
+ if (haystack !== undefined && haystack !== null && regex.test(haystack)) {
20
+ return;
21
+ }
22
+
23
+ throw new AssertionError({
24
+ message: message ?? "Expected string to match regular expression, but string did not match",
25
+ expected: regex,
26
+ actual: haystack
27
+ });
28
+ }