File: karma.conf.js

package info (click to toggle)
node-type-detect 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 156 kB
  • ctags: 55
  • sloc: makefile: 2; sh: 2
file content (96 lines) | stat: -rw-r--r-- 2,616 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
'use strict';
var packageJson = require('./package.json');
var defaultTimeout = 120000;
var browserifyIstanbul = require('browserify-istanbul');
module.exports = function configureKarma(config) {
  var localBrowsers = [
    'PhantomJS',
  ];
  var sauceLabsBrowsers = {
    SauceChromeLatest: {
      base: 'SauceLabs',
      browserName: 'Chrome',
    },
    SauceFirefoxLatest: {
      base: 'SauceLabs',
      browserName: 'Firefox',
    },
    SauceSafariLatest: {
      base: 'SauceLabs',
      browserName: 'Safari',
      platform: 'OS X 10.11',
    },
    SauceInternetExplorerLatest: {
      base: 'SauceLabs',
      browserName: 'Internet Explorer',
    },
    SauceInternetExplorerOldestSupported: {
      base: 'SauceLabs',
      browserName: 'Internet Explorer',
      version: 9,
    },
    SauceEdgeLatest: {
      base: 'SauceLabs',
      browserName: 'MicrosoftEdge',
    },
    SauceAndroidLatest: {
      base: 'SauceLabs',
      browserName: 'Android',
    },
  };
  config.set({
    basePath: '',
    browsers: localBrowsers,
    logLevel: process.env.npm_config_debug ? config.LOG_DEBUG : config.LOG_INFO,
    frameworks: [ 'browserify', 'mocha' ],
    files: [ 'test/*.js' ],
    exclude: [],
    preprocessors: {
      'test/*.js': [ 'browserify' ],
    },
    browserify: {
      debug: true,
      bare: true,
      transform: [
        browserifyIstanbul({ ignore: [ '**/node_modules/**', '**/test/**' ] }),
      ],
    },
    reporters: [ 'progress', 'coverage' ],
    coverageReporter: {
      type: 'lcov',
      dir: 'coverage',
    },
    port: 9876,
    colors: true,
    concurrency: 3,
    autoWatch: false,
    captureTimeout: defaultTimeout,
    browserDisconnectTimeout: defaultTimeout,
    browserNoActivityTimeout: defaultTimeout,
    singleRun: true,
  });

  if (process.env.SAUCE_ACCESS_KEY && process.env.SAUCE_USERNAME) {
    var branch = process.env.TRAVIS_BRANCH || 'local';
    var build = 'localbuild';
    if (process.env.TRAVIS_JOB_NUMBER) {
      build = 'travis@' + process.env.TRAVIS_JOB_NUMBER;
    }
    config.reporters.push('saucelabs');
    config.set({
      customLaunchers: sauceLabsBrowsers,
      browsers: localBrowsers.concat(Object.keys(sauceLabsBrowsers)),
      sauceLabs: {
        testName: packageJson.name,
        tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER || new Date().getTime(),
        recordVideo: true,
        startConnect: ('TRAVIS' in process.env) === false,
        tags: [
          'typeDetect_' + packageJson.version,
          process.env.SAUCE_USERNAME + '@' + branch,
          build,
        ],
      },
    });
  }
};