error-constants.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. 'use strict';
  2. /**
  3. * When Mocha throws exceptions (or rejects `Promise`s), it attempts to assign a `code` property to the `Error` object, for easier handling. These are the potential values of `code`.
  4. * @public
  5. * @namespace
  6. * @memberof module:lib/errors
  7. */
  8. var constants = {
  9. /**
  10. * An unrecoverable error.
  11. * @constant
  12. * @default
  13. */
  14. FATAL: 'ERR_MOCHA_FATAL',
  15. /**
  16. * The type of an argument to a function call is invalid
  17. * @constant
  18. * @default
  19. */
  20. INVALID_ARG_TYPE: 'ERR_MOCHA_INVALID_ARG_TYPE',
  21. /**
  22. * The value of an argument to a function call is invalid
  23. * @constant
  24. * @default
  25. */
  26. INVALID_ARG_VALUE: 'ERR_MOCHA_INVALID_ARG_VALUE',
  27. /**
  28. * Something was thrown, but it wasn't an `Error`
  29. * @constant
  30. * @default
  31. */
  32. INVALID_EXCEPTION: 'ERR_MOCHA_INVALID_EXCEPTION',
  33. /**
  34. * An interface (e.g., `Mocha.interfaces`) is unknown or invalid
  35. * @constant
  36. * @default
  37. */
  38. INVALID_INTERFACE: 'ERR_MOCHA_INVALID_INTERFACE',
  39. /**
  40. * A reporter (.e.g, `Mocha.reporters`) is unknown or invalid
  41. * @constant
  42. * @default
  43. */
  44. INVALID_REPORTER: 'ERR_MOCHA_INVALID_REPORTER',
  45. /**
  46. * `done()` was called twice in a `Test` or `Hook` callback
  47. * @constant
  48. * @default
  49. */
  50. MULTIPLE_DONE: 'ERR_MOCHA_MULTIPLE_DONE',
  51. /**
  52. * No files matched the pattern provided by the user
  53. * @constant
  54. * @default
  55. */
  56. NO_FILES_MATCH_PATTERN: 'ERR_MOCHA_NO_FILES_MATCH_PATTERN',
  57. /**
  58. * Known, but unsupported behavior of some kind
  59. * @constant
  60. * @default
  61. */
  62. UNSUPPORTED: 'ERR_MOCHA_UNSUPPORTED',
  63. /**
  64. * Invalid state transition occurring in `Mocha` instance
  65. * @constant
  66. * @default
  67. */
  68. INSTANCE_ALREADY_RUNNING: 'ERR_MOCHA_INSTANCE_ALREADY_RUNNING',
  69. /**
  70. * Invalid state transition occurring in `Mocha` instance
  71. * @constant
  72. * @default
  73. */
  74. INSTANCE_ALREADY_DISPOSED: 'ERR_MOCHA_INSTANCE_ALREADY_DISPOSED',
  75. /**
  76. * Use of `only()` w/ `--forbid-only` results in this error.
  77. * @constant
  78. * @default
  79. */
  80. FORBIDDEN_EXCLUSIVITY: 'ERR_MOCHA_FORBIDDEN_EXCLUSIVITY',
  81. /**
  82. * To be thrown when a user-defined plugin implementation (e.g., `mochaHooks`) is invalid
  83. * @constant
  84. * @default
  85. */
  86. INVALID_PLUGIN_IMPLEMENTATION: 'ERR_MOCHA_INVALID_PLUGIN_IMPLEMENTATION',
  87. /**
  88. * To be thrown when a builtin or third-party plugin definition (the _definition_ of `mochaHooks`) is invalid
  89. * @constant
  90. * @default
  91. */
  92. INVALID_PLUGIN_DEFINITION: 'ERR_MOCHA_INVALID_PLUGIN_DEFINITION',
  93. /**
  94. * When a runnable exceeds its allowed run time.
  95. * @constant
  96. * @default
  97. */
  98. TIMEOUT: 'ERR_MOCHA_TIMEOUT',
  99. /**
  100. * Input file is not able to be parsed
  101. * @constant
  102. * @default
  103. */
  104. UNPARSABLE_FILE: 'ERR_MOCHA_UNPARSABLE_FILE'
  105. };
  106. module.exports = { constants };