index.mjs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* eslint no-console: 0 */
  2. /**
  3. * Test Runner
  4. *
  5. * For running the tests in the test register.
  6. *
  7. * @author tlwr [toby@toby.codes]
  8. * @author n1474335 [n1474335@gmail.com]
  9. * @copyright Crown Copyright 2017
  10. * @license Apache-2.0
  11. */
  12. import {
  13. setLongTestFailure,
  14. logTestReport,
  15. } from "../lib/utils";
  16. // Define global environment functions
  17. global.ENVIRONMENT_IS_WORKER = function() {
  18. return typeof importScripts === "function";
  19. };
  20. global.ENVIRONMENT_IS_NODE = function() {
  21. return typeof process === "object" && typeof require === "function";
  22. };
  23. global.ENVIRONMENT_IS_WEB = function() {
  24. return typeof window === "object";
  25. };
  26. import TestRegister from "../lib/TestRegister";
  27. import "./tests/BCD";
  28. import "./tests/BSON";
  29. import "./tests/Base58";
  30. import "./tests/Base64";
  31. import "./tests/Base62";
  32. import "./tests/BitwiseOp";
  33. import "./tests/ByteRepr";
  34. import "./tests/CartesianProduct";
  35. import "./tests/CharEnc";
  36. import "./tests/Charts";
  37. import "./tests/Checksum";
  38. import "./tests/Ciphers";
  39. import "./tests/Code";
  40. import "./tests/Comment";
  41. import "./tests/Compress";
  42. import "./tests/ConditionalJump";
  43. import "./tests/Crypt";
  44. import "./tests/CSV";
  45. import "./tests/DateTime";
  46. import "./tests/ExtractEmailAddresses";
  47. import "./tests/Fork";
  48. import "./tests/FromDecimal";
  49. import "./tests/Hash";
  50. import "./tests/HaversineDistance";
  51. import "./tests/Hexdump";
  52. import "./tests/Image";
  53. import "./tests/Jump";
  54. import "./tests/JSONBeautify";
  55. import "./tests/JSONMinify";
  56. import "./tests/JWTDecode";
  57. import "./tests/JWTSign";
  58. import "./tests/JWTVerify";
  59. import "./tests/MS";
  60. import "./tests/Magic";
  61. import "./tests/MorseCode";
  62. import "./tests/NetBIOS";
  63. import "./tests/OTP";
  64. import "./tests/PGP";
  65. import "./tests/PHP";
  66. import "./tests/ParseIPRange";
  67. import "./tests/ParseQRCode";
  68. import "./tests/PowerSet";
  69. import "./tests/Regex";
  70. import "./tests/Register";
  71. import "./tests/RemoveDiacritics";
  72. import "./tests/Rotate";
  73. import "./tests/SeqUtils";
  74. import "./tests/SetDifference";
  75. import "./tests/SetIntersection";
  76. import "./tests/SetUnion";
  77. import "./tests/StrUtils";
  78. import "./tests/SymmetricDifference";
  79. import "./tests/TextEncodingBruteForce";
  80. import "./tests/TranslateDateTimeFormat";
  81. import "./tests/Magic";
  82. import "./tests/ParseTLV";
  83. import "./tests/Media";
  84. import "./tests/ToFromInsensitiveRegex";
  85. import "./tests/YARA.mjs";
  86. import "./tests/ConvertCoordinateFormat";
  87. import "./tests/Enigma";
  88. import "./tests/Bombe";
  89. import "./tests/MultipleBombe";
  90. import "./tests/Typex";
  91. import "./tests/BLAKE2b";
  92. import "./tests/BLAKE2s";
  93. // Cannot test operations that use the File type yet
  94. //import "./tests/SplitColourChannels";
  95. // import "./tests/nodeApi/nodeApi";
  96. // import "./tests/nodeApi/ops";
  97. const testStatus = {
  98. allTestsPassing: true,
  99. counts: {
  100. total: 0,
  101. }
  102. };
  103. setLongTestFailure();
  104. const logOpsTestReport = logTestReport.bind(null, testStatus);
  105. TestRegister.runTests()
  106. .then(logOpsTestReport);