karma.sauce.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var version = require('./package.json').version;
  2. var ts = new Date().getTime();
  3. module.exports = function(config) {
  4. var auth;
  5. try {
  6. auth = require('./test/auth/index');
  7. } catch(ex) {
  8. auth = {};
  9. auth.SAUCE_USERNAME = process.env.SAUCE_USERNAME || null;
  10. auth.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY || null;
  11. }
  12. if (!auth.SAUCE_USERNAME || !auth.SAUCE_ACCESS_KEY) return;
  13. if (process.env.SKIP_SAUCE) return;
  14. var branch = process.env.TRAVIS_BRANCH || 'local'
  15. var browserConfig = require('./sauce.browsers');
  16. var browsers = Object.keys(browserConfig);
  17. var tags = [ 'chaijs_' + version, auth.SAUCE_USERNAME + '@' + branch ];
  18. var tunnel = process.env.TRAVIS_JOB_NUMBER || ts;
  19. if (process.env.TRAVIS_JOB_NUMBER) {
  20. tags.push('travis@' + process.env.TRAVIS_JOB_NUMBER);
  21. }
  22. config.browsers = config.browsers.concat(browsers);
  23. Object.assign(config.customLaunchers, browserConfig);
  24. config.reporters.push('saucelabs');
  25. config.captureTimeout = 300000;
  26. config.sauceLabs = {
  27. username: auth.SAUCE_USERNAME
  28. , accessKey: auth.SAUCE_ACCESS_KEY
  29. , startConnect: ('TRAVIS' in process.env) === false
  30. , tags: tags
  31. , testName: 'ChaiJS'
  32. , tunnelIdentifier: tunnel
  33. };
  34. };