BaseReporter.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. function _jestUtil() {
  7. const data = require('jest-util');
  8. _jestUtil = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _defineProperty(obj, key, value) {
  14. if (key in obj) {
  15. Object.defineProperty(obj, key, {
  16. value: value,
  17. enumerable: true,
  18. configurable: true,
  19. writable: true
  20. });
  21. } else {
  22. obj[key] = value;
  23. }
  24. return obj;
  25. }
  26. const {remove: preRunMessageRemove} = _jestUtil().preRunMessage;
  27. class BaseReporter {
  28. constructor() {
  29. _defineProperty(this, '_error', void 0);
  30. }
  31. log(message) {
  32. process.stderr.write(message + '\n');
  33. }
  34. onRunStart(_results, _options) {
  35. preRunMessageRemove(process.stderr);
  36. }
  37. onTestCaseResult(_test, _testCaseResult) {}
  38. onTestResult(_test, _testResult, _results) {}
  39. onTestStart(_test) {}
  40. onRunComplete(_contexts, _aggregatedResults) {}
  41. _setError(error) {
  42. this._error = error;
  43. } // Return an error that occurred during reporting. This error will
  44. // define whether the test run was successful or failed.
  45. getLastError() {
  46. return this._error;
  47. }
  48. }
  49. exports.default = BaseReporter;