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.

33 lines
1003 B

  1. const karmaLib = require('karma');
  2. //<=0.12 || //^0.13
  3. const twelveKarma = karmaLib.server ? karmaLib.server.start : undefined;
  4. const thirteenKarma = karmaLib.Server || undefined;
  5. const Karma = thirteenKarma || twelveKarma;
  6. // console.log(Karma,true);
  7. module.exports = (pathToKarmaFile, grunt) => {
  8. var log;
  9. log = grunt.log.oklns;
  10. return (done, karmaConf) => {
  11. var e, server;
  12. if (karmaConf == null) {
  13. karmaConf = require.resolve(pathToKarmaFile);
  14. }
  15. log('-- Karma Setup --');
  16. try {
  17. server = new Karma({
  18. configFile: karmaConf,
  19. singleRun: true
  20. }, (code) => {
  21. log("Karma Callback Code: " + code);
  22. done(!code ? void 0 : false);
  23. });
  24. if (server.start)
  25. server.start(); //^0.13
  26. } catch (_error) {
  27. e = _error;
  28. log("KARMA ERROR: " + e);
  29. return done(false);
  30. }
  31. };
  32. };