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.

global-setup.js 806B

1234567891011121314151617181920212223242526272829303132
  1. const jsdom = require("jsdom");
  2. exports.startApplication = function (configFilename, exec) {
  3. jest.resetModules();
  4. if (global.app) {
  5. global.app.stop();
  6. }
  7. // Set config sample for use in test
  8. process.env.MM_CONFIG_FILE = configFilename;
  9. if (exec) exec;
  10. global.app = require("app.js");
  11. global.app.start();
  12. };
  13. exports.stopApplication = function () {
  14. if (global.app) {
  15. global.app.stop();
  16. }
  17. };
  18. exports.getDocument = function (callback, ms) {
  19. const url = "http://" + (config.address || "localhost") + ":" + (config.port || "8080");
  20. jsdom.JSDOM.fromURL(url, { resources: "usable", runScripts: "dangerously" }).then((dom) => {
  21. dom.window.name = "jsdom";
  22. dom.window.onload = function () {
  23. global.document = dom.window.document;
  24. setTimeout(() => {
  25. callback();
  26. }, ms);
  27. };
  28. });
  29. };