Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. 'use strict';
  2. var Runnable = require('./runnable');
  3. var utils = require('./utils');
  4. var errors = require('./errors');
  5. var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
  6. var isString = utils.isString;
  7. module.exports = Test;
  8. /**
  9. * Initialize a new `Test` with the given `title` and callback `fn`.
  10. *
  11. * @public
  12. * @class
  13. * @extends Runnable
  14. * @param {String} title - Test title (required)
  15. * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
  16. */
  17. function Test(title, fn) {
  18. if (!isString(title)) {
  19. throw createInvalidArgumentTypeError(
  20. 'Test argument "title" should be a string. Received type "' +
  21. typeof title +
  22. '"',
  23. 'title',
  24. 'string'
  25. );
  26. }
  27. this.type = 'test';
  28. Runnable.call(this, title, fn);
  29. this.reset();
  30. }
  31. /**
  32. * Inherit from `Runnable.prototype`.
  33. */
  34. utils.inherits(Test, Runnable);
  35. /**
  36. * Resets the state initially or for a next run.
  37. */
  38. Test.prototype.reset = function() {
  39. Runnable.prototype.reset.call(this);
  40. this.pending = !this.fn;
  41. delete this.state;
  42. };
  43. /**
  44. * Set or get retried test
  45. *
  46. * @private
  47. */
  48. Test.prototype.retriedTest = function(n) {
  49. if (!arguments.length) {
  50. return this._retriedTest;
  51. }
  52. this._retriedTest = n;
  53. };
  54. /**
  55. * Add test to the list of tests marked `only`.
  56. *
  57. * @private
  58. */
  59. Test.prototype.markOnly = function() {
  60. this.parent.appendOnlyTest(this);
  61. };
  62. Test.prototype.clone = function() {
  63. var test = new Test(this.title, this.fn);
  64. test.timeout(this.timeout());
  65. test.slow(this.slow());
  66. test.enableTimeouts(this.enableTimeouts());
  67. test.retries(this.retries());
  68. test.currentRetry(this.currentRetry());
  69. test.retriedTest(this.retriedTest() || this);
  70. test.globals(this.globals());
  71. test.parent = this.parent;
  72. test.file = this.file;
  73. test.ctx = this.ctx;
  74. return test;
  75. };