karma.sauce.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. 'use strict';
  2. var fs = require('fs');
  3. module.exports = function(config) {
  4. // Use ENV vars on Travis and sauce.json locally to get credentials
  5. if (!process.env.SAUCE_USERNAME) {
  6. if (!fs.existsSync('sauce.json')) {
  7. console.log('Create a sauce.json with your credentials based on the sauce-sample.json file.');
  8. process.exit(1);
  9. } else {
  10. process.env.SAUCE_USERNAME = require('./sauce').username;
  11. process.env.SAUCE_ACCESS_KEY = require('./sauce').accessKey;
  12. }
  13. }
  14. // Browsers to run on Sauce Labs
  15. var customLaunchers = {
  16. 'SL_Chrome_27': {
  17. base: 'SauceLabs',
  18. browserName: 'chrome',
  19. version: '27'
  20. },
  21. 'SL_Chrome': {
  22. base: 'SauceLabs',
  23. browserName: 'chrome'
  24. },
  25. 'SL_InternetExplorer_10': {
  26. base: 'SauceLabs',
  27. browserName: 'internet explorer',
  28. version: '10'
  29. },
  30. 'SL_InternetExplorer': {
  31. base: 'SauceLabs',
  32. browserName: 'internet explorer'
  33. },
  34. 'SL_MicrosoftEdge': {
  35. base: 'SauceLabs',
  36. browserName: 'MicrosoftEdge'
  37. },
  38. 'SL_FireFox_17': {
  39. base: 'SauceLabs',
  40. browserName: 'firefox',
  41. version: '17'
  42. },
  43. 'SL_FireFox': {
  44. base: 'SauceLabs',
  45. browserName: 'firefox'
  46. },
  47. 'SL_Safari_7': {
  48. base: 'SauceLabs',
  49. browserName: 'safari',
  50. version: '7'
  51. },
  52. 'SL_Safari': {
  53. base: 'SauceLabs',
  54. browserName: 'safari'
  55. },
  56. 'SL_iPhone_8': {
  57. base: 'SauceLabs',
  58. browserName: 'iphone',
  59. version: '8.4'
  60. },
  61. 'SL_iPhone': {
  62. base: 'SauceLabs',
  63. browserName: 'iphone'
  64. },
  65. 'SL_Android': {
  66. base: 'SauceLabs',
  67. browserName: 'android'
  68. }
  69. };
  70. config.set({
  71. // base path that will be used to resolve all patterns (eg. files, exclude)
  72. basePath: '',
  73. // frameworks to use
  74. // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
  75. frameworks: ['mocha'],
  76. // list of files / patterns to load in the browser
  77. files: [
  78. 'dist/ajv.min.js',
  79. 'node_modules/chai/chai.js',
  80. 'node_modules/ajv-async/dist/ajv-async.min.js',
  81. 'node_modules/bluebird/js/browser/bluebird.core.min.js',
  82. '.browser/*.spec.js'
  83. ],
  84. // test results reporter to use
  85. // possible values: 'dots', 'progress'
  86. // available reporters: https://npmjs.org/browse/keyword/karma-reporter
  87. reporters: ['dots', 'saucelabs'],
  88. // web server port
  89. port: 9876,
  90. colors: true,
  91. // level of logging
  92. // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
  93. logLevel: config.LOG_INFO,
  94. sauceLabs: {
  95. testName: 'Ajv',
  96. 'idleTimeout': 900
  97. },
  98. captureTimeout: 1200000,
  99. browserNoActivityTimeout: 600000,
  100. browserDisconnectTimeout: 60000,
  101. customLaunchers: customLaunchers,
  102. // start these browsers
  103. // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
  104. browsers: Object.keys(customLaunchers),
  105. singleRun: true
  106. });
  107. };