Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

index.js 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. Object.defineProperty(exports, 'setState', {
  6. enumerable: true,
  7. get: function () {
  8. return _state.setState;
  9. }
  10. });
  11. Object.defineProperty(exports, 'getState', {
  12. enumerable: true,
  13. get: function () {
  14. return _state.getState;
  15. }
  16. });
  17. Object.defineProperty(exports, 'resetState', {
  18. enumerable: true,
  19. get: function () {
  20. return _state.resetState;
  21. }
  22. });
  23. Object.defineProperty(exports, 'run', {
  24. enumerable: true,
  25. get: function () {
  26. return _run.default;
  27. }
  28. });
  29. exports.default =
  30. exports.test =
  31. exports.it =
  32. exports.describe =
  33. exports.beforeEach =
  34. exports.beforeAll =
  35. exports.afterEach =
  36. exports.afterAll =
  37. void 0;
  38. var _jestEach = require('jest-each');
  39. var _jestUtil = require('jest-util');
  40. var _state = require('./state');
  41. var _run = _interopRequireDefault(require('./run'));
  42. function _interopRequireDefault(obj) {
  43. return obj && obj.__esModule ? obj : {default: obj};
  44. }
  45. /**
  46. * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
  47. *
  48. * This source code is licensed under the MIT license found in the
  49. * LICENSE file in the root directory of this source tree.
  50. */
  51. const describe = (() => {
  52. const describe = (blockName, blockFn) =>
  53. _dispatchDescribe(blockFn, blockName, describe);
  54. const only = (blockName, blockFn) =>
  55. _dispatchDescribe(blockFn, blockName, only, 'only');
  56. const skip = (blockName, blockFn) =>
  57. _dispatchDescribe(blockFn, blockName, skip, 'skip');
  58. describe.each = (0, _jestEach.bind)(describe, false);
  59. only.each = (0, _jestEach.bind)(only, false);
  60. skip.each = (0, _jestEach.bind)(skip, false);
  61. describe.only = only;
  62. describe.skip = skip;
  63. return describe;
  64. })();
  65. exports.describe = describe;
  66. const _dispatchDescribe = (blockFn, blockName, describeFn, mode) => {
  67. const asyncError = new _jestUtil.ErrorWithStack(undefined, describeFn);
  68. if (blockFn === undefined) {
  69. asyncError.message = `Missing second argument. It must be a callback function.`;
  70. throw asyncError;
  71. }
  72. if (typeof blockFn !== 'function') {
  73. asyncError.message = `Invalid second argument, ${blockFn}. It must be a callback function.`;
  74. throw asyncError;
  75. }
  76. (0, _state.dispatchSync)({
  77. asyncError,
  78. blockName,
  79. mode,
  80. name: 'start_describe_definition'
  81. });
  82. const describeReturn = blockFn();
  83. if ((0, _jestUtil.isPromise)(describeReturn)) {
  84. throw new _jestUtil.ErrorWithStack(
  85. 'Returning a Promise from "describe" is not supported. Tests must be defined synchronously.',
  86. describeFn
  87. );
  88. } else if (describeReturn !== undefined) {
  89. throw new _jestUtil.ErrorWithStack(
  90. 'A "describe" callback must not return a value.',
  91. describeFn
  92. );
  93. }
  94. (0, _state.dispatchSync)({
  95. blockName,
  96. mode,
  97. name: 'finish_describe_definition'
  98. });
  99. };
  100. const _addHook = (fn, hookType, hookFn, timeout) => {
  101. const asyncError = new _jestUtil.ErrorWithStack(undefined, hookFn);
  102. if (typeof fn !== 'function') {
  103. asyncError.message =
  104. 'Invalid first argument. It must be a callback function.';
  105. throw asyncError;
  106. }
  107. (0, _state.dispatchSync)({
  108. asyncError,
  109. fn,
  110. hookType,
  111. name: 'add_hook',
  112. timeout
  113. });
  114. }; // Hooks have to pass themselves to the HOF in order for us to trim stack traces.
  115. const beforeEach = (fn, timeout) =>
  116. _addHook(fn, 'beforeEach', beforeEach, timeout);
  117. exports.beforeEach = beforeEach;
  118. const beforeAll = (fn, timeout) =>
  119. _addHook(fn, 'beforeAll', beforeAll, timeout);
  120. exports.beforeAll = beforeAll;
  121. const afterEach = (fn, timeout) =>
  122. _addHook(fn, 'afterEach', afterEach, timeout);
  123. exports.afterEach = afterEach;
  124. const afterAll = (fn, timeout) => _addHook(fn, 'afterAll', afterAll, timeout);
  125. exports.afterAll = afterAll;
  126. const test = (() => {
  127. const test = (testName, fn, timeout) =>
  128. _addTest(testName, undefined, fn, test, timeout);
  129. const skip = (testName, fn, timeout) =>
  130. _addTest(testName, 'skip', fn, skip, timeout);
  131. const only = (testName, fn, timeout) =>
  132. _addTest(testName, 'only', fn, test.only, timeout);
  133. test.todo = (testName, ...rest) => {
  134. if (rest.length > 0 || typeof testName !== 'string') {
  135. throw new _jestUtil.ErrorWithStack(
  136. 'Todo must be called with only a description.',
  137. test.todo
  138. );
  139. }
  140. return _addTest(testName, 'todo', () => {}, test.todo);
  141. };
  142. const _addTest = (testName, mode, fn, testFn, timeout) => {
  143. const asyncError = new _jestUtil.ErrorWithStack(undefined, testFn);
  144. if (typeof testName !== 'string') {
  145. asyncError.message = `Invalid first argument, ${testName}. It must be a string.`;
  146. throw asyncError;
  147. }
  148. if (fn === undefined) {
  149. asyncError.message =
  150. 'Missing second argument. It must be a callback function. Perhaps you want to use `test.todo` for a test placeholder.';
  151. throw asyncError;
  152. }
  153. if (typeof fn !== 'function') {
  154. asyncError.message = `Invalid second argument, ${fn}. It must be a callback function.`;
  155. throw asyncError;
  156. }
  157. return (0, _state.dispatchSync)({
  158. asyncError,
  159. fn,
  160. mode,
  161. name: 'add_test',
  162. testName,
  163. timeout
  164. });
  165. };
  166. test.each = (0, _jestEach.bind)(test);
  167. only.each = (0, _jestEach.bind)(only);
  168. skip.each = (0, _jestEach.bind)(skip);
  169. test.only = only;
  170. test.skip = skip;
  171. return test;
  172. })();
  173. exports.test = test;
  174. const it = test;
  175. exports.it = it;
  176. var _default = {
  177. afterAll,
  178. afterEach,
  179. beforeAll,
  180. beforeEach,
  181. describe,
  182. it,
  183. test
  184. };
  185. exports.default = _default;