<commit_before>/*global process */

module.exports = function(karma) {
  'use strict';

  var
    env = process.env,
    paths;

  paths = {
    bowerComponents: 'bower_components',
    vendor: 'vendor',
    tests: 'tests',
    js: 'js',
    partials: 'partials'
  };

  karma.set({
    // base path, that will be used to resolve files and exclude
    basePath: '.',

    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      paths.bowerComponents + '/html5shiv/dist/html5shiv.js',
      paths.bowerComponents + '/respond/dest/respond.src.js',
      paths.bowerComponents + '/firebase/firebase.js',
      paths.bowerComponents + '/modernizr/modernizr.js',
      paths.bowerComponents + '/angular/angular.js',
      paths.bowerComponents + '/angular-route/angular-route.js',
      paths.bowerComponents + '/angular-mocks/angular-mocks.js',
      paths.bowerComponents + '/angular-sanitize/angular-sanitize.js',
      paths.bowerComponents + '/angular-touch/angular-touch.js',
      paths.bowerComponents + '/angular-animate/angular-animate.js',
      paths.bowerComponents + '/angularfire/angularfire.js',
      paths.bowerComponents + '/ngstorage/ngStorage.js',
      paths.partials + '/templates.js',
      paths.js + '/config.js',
      paths.js + '/JcApp.js',
      paths.js + '/AppFilters.js',
      paths.js + '/**/*.js',
      paths.tests +'/unit/**/*Spec.js'
    ],

    // list of files to exclude
    exclude: [],

    // use dolts reporter, as travis terminal does not support escaping sequences
    // possible values: 'dots', 'progress', 'junit', 'teamcity'
    // CLI --reporters progress
    reporters: ['progress', 'coverage', 'saucelabs'],

    // web server port
    // CLI --port 9876
    port: 9876,

    // cli runner port
    // CLI --runner-port 9100
    runnerPort: 9100,

    // enable / disable colors in the output (reporters and logs)
    // CLI --colors --no-colors
    colors: true,

    // level of logging
    // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
    // CLI --log-level debug
    logLevel: karma.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    // CLI --auto-watch --no-auto-watch
    autoWatch: true,

    sauceLabs: {
      username: env.SAUCE_USERNAME,
      accessKey: env.SAUCE_ACCESS_KEY,
      startConnect: true,
      testName: 'javiercejudo.com: unit tests'
    },

    customLaunchers: {
      'SL_Chrome': {
        base: 'SauceLabs',
        browserName: 'chrome'
      },
      'SL_Firefox': {
        base: 'SauceLabs',
        browserName: 'firefox',
        version: '26'
      },
      'SL_Safari': {
        base: 'SauceLabs',
        browserName: 'safari',
        platform: 'OS X 10.9',
        version: '7'
      },
      'SL_IE_9': {
        base: 'SauceLabs',
        browserName: 'internet explorer',
        platform: 'Windows 2008',
        version: '9'
      },
      'SL_IE_10': {
        base: 'SauceLabs',
        browserName: 'internet explorer',
        platform: 'Windows 2012',
        version: '10'
      },
      'SL_IE_11': {
        base: 'SauceLabs',
        browserName: 'internet explorer',
        platform: 'Windows 8.1',
        version: '11'
      }
    },

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    // CLI --browsers Chrome,Firefox,Safari
    browsers: [
      'SL_Chrome',
      'SL_Firefox',
      'SL_Safari',
      'SL_IE_11'
    ],

    // If browser does not capture in given timeout [ms], kill it
    // CLI --capture-timeout 5000
    captureTimeout: 5000,

    // Auto run tests on start (when browsers are captured) and exit
    // CLI --single-run --no-single-run
    singleRun: true,

    // report which specs are slower than [ms]
    // CLI --report-slower-than 500
    reportSlowerThan: 500,

    // compile coffee scripts
    preprocessors: {
      'js/**/*.js': ['coverage']
    },

    coverageReporter: {
      type : 'lcov',
      dir : 'coverage/'
    },

    plugins: [
      'karma-jasmine',
      'karma-coverage',
      'karma-phantomjs-launcher',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-sauce-launcher'
    ]
  });
};
<commit_msg>Add jQuery to the tests<commit_after>/*global process */

module.exports = function(karma) {
  'use strict';

  var
    env = process.env,
    paths;

  paths = {
    bowerComponents: 'bower_components',
    vendor: 'vendor',
    tests: 'tests',
    js: 'js',
    partials: 'partials'
  };

  karma.set({
    // base path, that will be used to resolve files and exclude
    basePath: '.',

    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      paths.bowerComponents + '/html5shiv/dist/html5shiv.js',
      paths.bowerComponents + '/respond/dest/respond.src.js',
      paths.bowerComponents + '/firebase/firebase.js',
      paths.bowerComponents + '/modernizr/modernizr.js',
      paths.bowerComponents + '/jquery/dist/jquery.js',
      paths.bowerComponents + '/angular/angular.js',
      paths.bowerComponents + '/angular-route/angular-route.js',
      paths.bowerComponents + '/angular-mocks/angular-mocks.js',
      paths.bowerComponents + '/angular-sanitize/angular-sanitize.js',
      paths.bowerComponents + '/angular-touch/angular-touch.js',
      paths.bowerComponents + '/angular-animate/angular-animate.js',
      paths.bowerComponents + '/angularfire/angularfire.js',
      paths.bowerComponents + '/ngstorage/ngStorage.js',
      paths.partials + '/templates.js',
      paths.js + '/config.js',
      paths.js + '/JcApp.js',
      paths.js + '/AppFilters.js',
      paths.js + '/**/*.js',
      paths.tests +'/unit/**/*Spec.js'
    ],

    // list of files to exclude
    exclude: [],

    // use dolts reporter, as travis terminal does not support escaping sequences
    // possible values: 'dots', 'progress', 'junit', 'teamcity'
    // CLI --reporters progress
    reporters: ['progress', 'coverage', 'saucelabs'],

    // web server port
    // CLI --port 9876
    port: 9876,

    // cli runner port
    // CLI --runner-port 9100
    runnerPort: 9100,

    // enable / disable colors in the output (reporters and logs)
    // CLI --colors --no-colors
    colors: true,

    // level of logging
    // possible values: karma.LOG_DISABLE || karma.LOG_ERROR || karma.LOG_WARN || karma.LOG_INFO || karma.LOG_DEBUG
    // CLI --log-level debug
    logLevel: karma.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    // CLI --auto-watch --no-auto-watch
    autoWatch: true,

    sauceLabs: {
      username: env.SAUCE_USERNAME,
      accessKey: env.SAUCE_ACCESS_KEY,
      startConnect: true,
      testName: 'javiercejudo.com: unit tests'
    },

    customLaunchers: {
      'SL_Chrome': {
        base: 'SauceLabs',
        browserName: 'chrome'
      },
      'SL_Firefox': {
        base: 'SauceLabs',
        browserName: 'firefox',
        version: '26'
      },
      'SL_Safari': {
        base: 'SauceLabs',
        browserName: 'safari',
        platform: 'OS X 10.9',
        version: '7'
      },
      'SL_IE_9': {
        base: 'SauceLabs',
        browserName: 'internet explorer',
        platform: 'Windows 2008',
        version: '9'
      },
      'SL_IE_10': {
        base: 'SauceLabs',
        browserName: 'internet explorer',
        platform: 'Windows 2012',
        version: '10'
      },
      'SL_IE_11': {
        base: 'SauceLabs',
        browserName: 'internet explorer',
        platform: 'Windows 8.1',
        version: '11'
      }
    },

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    // CLI --browsers Chrome,Firefox,Safari
    browsers: [
      'SL_Chrome',
      'SL_Firefox',
      'SL_Safari',
      'SL_IE_11'
    ],

    // If browser does not capture in given timeout [ms], kill it
    // CLI --capture-timeout 5000
    captureTimeout: 5000,

    // Auto run tests on start (when browsers are captured) and exit
    // CLI --single-run --no-single-run
    singleRun: true,

    // report which specs are slower than [ms]
    // CLI --report-slower-than 500
    reportSlowerThan: 500,

    // compile coffee scripts
    preprocessors: {
      'js/**/*.js': ['coverage']
    },

    coverageReporter: {
      type : 'lcov',
      dir : 'coverage/'
    },

    plugins: [
      'karma-jasmine',
      'karma-coverage',
      'karma-phantomjs-launcher',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-sauce-launcher'
    ]
  });
};
<|endoftext|>


<commit_before>#!/usr/bin/env node

/*!
 * sequomics® [v1.0.0]
 * ______________________________________________________________
 * karma, https://github.com/karma-runner/karma
 * The Spectacular Test Runner for JavaScript.
 * ______________________________________________________________
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/]
 * @copyright : Sequømics Corporation [http://sequomics.com/]
 * ______________________________________________________________
 * @date      : 11-Jan-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * ______________________________________________________________
 *
 * --/The Heart of Karma Test Runner System/-- of "sequomics®".
 * ______________________________________________________________
 */

// # Usage: $ node -v
// # Usage: $ npm -v

// =========================
// Test Module(s) Required.
// =========================
// main module.
// @require   : karma
// @require   : grunt-karma
<commit_msg>Initial commit<commit_after>#!/usr/bin/env node

/*!
 * sequomics® [v1.0.0]
 * ______________________________________________________________
 * karma, https://github.com/karma-runner/karma
 * The Spectacular Test Runner for JavaScript.
 * ______________________________________________________________
 * Architecture and Code Handcrafted by Prabhat Kumar.
 * Architectuur en Code handgemaakt door Prabhat Kumar.
 * @author    : Prabhat Kumar [http://prabhatkumar.org/]
 * @copyright : Sequømics Corporation [http://sequomics.com/]
 * ______________________________________________________________
 * @date      : 11-Jan-2016
 * @license   : Apache, version 2.0
 * @require   : Node.js®
 * @require   : NPM
 * ______________________________________________________________
 *
 * --/The Heart of Karma Test Runner System/-- of "sequomics®".
 * ______________________________________________________________
 */

// # Usage: $ node -v
// # Usage: $ npm -v

// =========================
// Test Module(s) Required.
// =========================
// main module.
// @require   : karma
// @require   : grunt-karma

/* Invoking strict mode. */
"use strict";
<|endoftext|>


<commit_before>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function (config) {
    config.set({
        // base path, that will be used to resolve files and exclude
        basePath: '',

        // testing framework to use (jasmine/mocha/qunit/...)
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            'client/bower_components/jquery/dist/jquery.js',
            'client/bower_components/angular/angular.js',
            'client/bower_components/angular-mocks/angular-mocks.js',
            'client/bower_components/angular-resource/angular-resource.js',
            'client/bower_components/angular-cookies/angular-cookies.js',
            'client/bower_components/angular-sanitize/angular-sanitize.js',
            'client/bower_components/angular-moment/angular-moment.js',
            'client/bower_components/angular-emojis/lib/emoji.js',
            'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
            'client/bower_components/lodash/lodash.js',
            'client/bower_components/angular-socket-io/socket.js',
            'client/bower_components/angular-ui-router/release/angular-ui-router.js',
            'client/bower_components/angular-material/angular-material.js',
            'client/bower_components/angular-animate/angular-animate.js',
            'client/bower_components/angular-aria/angular-aria.js',
            'client/bower_components/hammer.js/hammer.js',
            'client/app/app.js',
            'client/app/**/*.js',
            'client/app/**/*.jade',
        ],

        reporters: ['progress', 'coverage'],

        coverageReporter: { type : 'lcovonly', dir: 'coverage', file: 'lcov.info' },

        preprocessors: {
            '**/*.jade': 'ng-jade2js',
            '**/*.html': 'html2js',
            '**/*.coffee': 'coffee',
            '**/*.js': ['coverage']
        },

        ngHtml2JsPreprocessor: {
            stripPrefix: 'client/'
        },

        ngJade2JsPreprocessor: {
            stripPrefix: 'client/'
        },

        // list of files / patterns to exclude
        exclude: [],

        // web server port
        port: 7999,

        // level of logging
        // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: false,

        // Start these browsers, currently available:
        // - Chrome
        // - ChromeCanary
        // - Firefox
        // - Opera
        // - Safari (only Mac)
        // - PhantomJS
        // - IE (only Windows)
        browsers: ['PhantomJS'],

        // Continuous Integration mode
        // if true, it capture browsers, run tests and exit
        singleRun: false
    });
};
<commit_msg>stub to rebuild<commit_after>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function (config) {
    config.set({
        // base path, that will be used to resolve files and exclude
        basePath: '',

        // testing framework to use (jasmine/mocha/qunit/...)
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            'client/bower_components/jquery/dist/jquery.js',
            'client/bower_components/angular/angular.js',
            'client/bower_components/angular-mocks/angular-mocks.js',
            'client/bower_components/angular-resource/angular-resource.js',
            'client/bower_components/angular-cookies/angular-cookies.js',
            'client/bower_components/angular-sanitize/angular-sanitize.js',
            'client/bower_components/angular-moment/angular-moment.js',
            'client/bower_components/angular-emojis/lib/emoji.js',
            'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
            'client/bower_components/lodash/lodash.js',
            'client/bower_components/angular-socket-io/socket.js',
            'client/bower_components/angular-ui-router/release/angular-ui-router.js',
            'client/bower_components/angular-material/angular-material.js',
            'client/bower_components/angular-animate/angular-animate.js',
            'client/bower_components/angular-aria/angular-aria.js',
            'client/bower_components/hammer.js/hammer.js',
            'client/app/app.js',
            'client/app/**/*.js',
            'client/app/**/*.jade',
        ],

        reporters: ['progress', 'coverage'],

        coverageReporter: { type : 'lcovonly', dir: 'coverage', file: 'lcov.info' },

        preprocessors: {
            '**/*.jade': 'ng-jade2js',
            '**/*.html': 'html2js',
            '**/*.coffee': 'coffee',
            '**/*.js': ['coverage']
        },

        ngHtml2JsPreprocessor: {
            stripPrefix: 'client/'
        },

        ngJade2JsPreprocessor: {
            stripPrefix: 'client/'
        },

        // list of files / patterns to exclude
        exclude: [],

        // web server port
        port: 7999,

        // level of logging
        // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: false,

        // Start these browsers, currently available:
        // - Chrome
        // - ChromeCanary
        // - Firefox
        // - Opera
        // - Safari (only Mac)
        // - PhantomJS
        // - IE (only Windows)
        browsers: [
            'PhantomJS'
        ],

        // Continuous Integration mode
        // if true, it capture browsers, run tests and exit
        singleRun: false
    });
};
<|endoftext|>


<commit_before>const webpack = require('webpack')
const sauceLaunchers = require('./sauceLaunchers.config')

var browsers
if (process.env.TRAVIS) {
  // Travis only comes with Firefox
  browsers = ['Firefox']
} else if (process.env.SAUCE) {
  if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
    console.error('SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables must be set!')
    process.exit(1)
  }
  browsers = Object.keys(sauceLaunchers)
} else if (process.platform === 'darwin') {
  browsers = ['Chrome', 'Firefox', 'Safari']
} else {
  browsers = ['Chrome', 'Firefox']
}

module.exports = function (config) {
  const ci = process.env.CI
  const sauce = process.env.SAUCE

  config.set({
    singleRun: true,
    frameworks: ['jasmine'],
    files: [
      'stylesheets/minimal.css',
      'test/acceptance/tests.js'
    ],
    preprocessors: {
      'test/acceptance/tests.js': ['webpack', 'sourcemap']
    },
    reporters: ['dots', 'saucelabs'],
    webpack: {
      module: {
        loaders: [
          {
            test: /\.js$/,
            loaders: ['babel-loader'],
            exclude: /node_modules/
          }
        ]
      },
      plugins: [
        new webpack.DefinePlugin({
          'process.env': {
            NODE_ENV: JSON.stringify(process.env.NODE_ENV),
            WATCH: process.env.WATCH
          }
        })
      ],
      devtool: 'inline-source-map'
    },
    webpackMiddleware: {
      stats: 'errors-only'
    },
    sauceLabs: {
      testName: ci ? 'Rollex acceptance tests (CI)' : 'Rollex acceptance tests'
    },
    browsers: browsers,
    concurrency: (ci || sauce) ? 2 : Infinity,
    captureTimeout: 300000,
    browserNoActivityTimeout: 300000,
    customLaunchers: sauceLaunchers
  })
}
<commit_msg>Run local acceptance tests in Chrome only<commit_after>const webpack = require('webpack')
const sauceLaunchers = require('./sauceLaunchers.config')

var browsers
if (process.env.TRAVIS) {
  // Travis only comes with Firefox
  browsers = ['Firefox']
} else if (process.env.SAUCE) {
  if (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY) {
    console.error('SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables must be set!')
    process.exit(1)
  }
  browsers = Object.keys(sauceLaunchers)
} else {
  browsers = ['Chrome']
}

module.exports = function (config) {
  const ci = process.env.CI
  const sauce = process.env.SAUCE

  config.set({
    singleRun: true,
    frameworks: ['jasmine'],
    files: [
      'stylesheets/minimal.css',
      'test/acceptance/tests.js'
    ],
    preprocessors: {
      'test/acceptance/tests.js': ['webpack', 'sourcemap']
    },
    reporters: ['dots', 'saucelabs'],
    webpack: {
      module: {
        loaders: [
          {
            test: /\.js$/,
            loaders: ['babel-loader'],
            exclude: /node_modules/
          }
        ]
      },
      plugins: [
        new webpack.DefinePlugin({
          'process.env': {
            NODE_ENV: JSON.stringify(process.env.NODE_ENV),
            WATCH: process.env.WATCH
          }
        })
      ],
      devtool: 'inline-source-map'
    },
    webpackMiddleware: {
      stats: 'errors-only'
    },
    sauceLabs: {
      testName: ci ? 'Rollex acceptance tests (CI)' : 'Rollex acceptance tests'
    },
    browsers: browsers,
    concurrency: (ci || sauce) ? 2 : Infinity,
    captureTimeout: 300000,
    browserNoActivityTimeout: 300000,
    customLaunchers: sauceLaunchers
  })
}
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Mon Apr 20 2015 06:33:20 GMT-0700 (PDT)

module.exports = function(config) {
  var harmony_flags = '--js-flags="' + [
    '--harmony',
  ].join(' ') + '"';

  var configuration = {

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha', 'requirejs', 'chai'],

    // list of files / patterns to load in the browser
    files: [
      'lib/runtime/dart_*.js',
      'lib/runtime/_*.js',
      'lib/runtime/dart/*.js',
      // {pattern: 'test/browser/*.js', included: false}
      'test/codegen/expect/async_helper/async_helper.js',
      'test/codegen/expect/dom/dom.js',
      'test/codegen/expect/expect/expect.js',
      'test/codegen/expect/unittest/unittest.js',
      'test/codegen/expect/syncstar_syntax.js',
      'test/codegen/expect/language/*.js',
      'test/browser/*.js',
      'test-main.js',
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    client: {
      mocha: {
        ui: 'tdd'
      },
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher

    // FIXME(vsm): Once harmony is on by default, we can simply add the following:
    //   browsers: ['Chrome'],
    // and remove the custom launchers.
    customLaunchers: {
      chrome_harmony: {
        base: 'Chrome',
        flags: [ harmony_flags ],
      },

      chrome_canary_harmony: {
        base: 'ChromeCanary',
        flags: [ harmony_flags ],
      },

      chrome_canary_travis: {
        base: 'ChromeCanary',
        flags: [ '--no-sandbox', harmony_flags ]
      },
    },
    browsers: ['chrome_canary_harmony'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,
  };

  if (process.env.TRAVIS) {
    configuration.browsers = ['chrome_canary_travis'];
    configuration.autoWatch = false;
    configuration.logLevel = config.LOG_DEBUG;
  }

  config.set(configuration);
};
<commit_msg>Suppress console logs when testing locally<commit_after>// Karma configuration
// Generated on Mon Apr 20 2015 06:33:20 GMT-0700 (PDT)

module.exports = function(config) {
  var harmony_flags = '--js-flags="' + [
    '--harmony',
  ].join(' ') + '"';

  var configuration = {

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha', 'requirejs', 'chai'],

    // list of files / patterns to load in the browser
    files: [
      'lib/runtime/dart_*.js',
      'lib/runtime/_*.js',
      'lib/runtime/dart/*.js',
      // {pattern: 'test/browser/*.js', included: false}
      'test/codegen/expect/async_helper/async_helper.js',
      'test/codegen/expect/dom/dom.js',
      'test/codegen/expect/expect/expect.js',
      'test/codegen/expect/unittest/unittest.js',
      'test/codegen/expect/syncstar_syntax.js',
      'test/codegen/expect/language/*.js',
      'test/browser/*.js',
      'test-main.js',
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    client: {
      captureConsole: false,
      mocha: {
        ui: 'tdd'
      },
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher

    // FIXME(vsm): Once harmony is on by default, we can simply add the following:
    //   browsers: ['Chrome'],
    // and remove the custom launchers.
    customLaunchers: {
      chrome_harmony: {
        base: 'Chrome',
        flags: [ harmony_flags ],
      },

      chrome_canary_harmony: {
        base: 'ChromeCanary',
        flags: [ harmony_flags ],
      },

      chrome_canary_travis: {
        base: 'ChromeCanary',
        flags: [ '--no-sandbox', harmony_flags ]
      },
    },
    browsers: ['chrome_canary_harmony'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,
  };

  if (process.env.TRAVIS) {
    configuration.browsers = ['chrome_canary_travis'];
    configuration.autoWatch = false;
    configuration.logLevel = config.LOG_DEBUG;
    configuration.client.captureConsole = true;
  }

  config.set(configuration);
};
<|endoftext|>


<commit_before>module.exports = function (config) {
	config.set({
		basePath : '',
		frameworks: ['jasmine', 'requirejs'],
        files: [
//			'../lib/**/*.js',
//			'../test/spec/*.js'
//            {pattern: 'test-main.js', included: true},
            'test-main.js',
            {pattern: '*test.js', included: false},
            {pattern: 'sqr*.js', included: false},
            {pattern: '**/vectortools.js', included: false},
        ],
        exclude: [
			'lib/requireconfig.js',
			'karma.conf.js'
        ],
		browsers : ['PhantomJS'],
		reporters : ['progress', 'spec', 'coverage', 'html'],
		preprocessors: {
			//'../lib/**/*.js': 'coverage'
			'*.js': 'coverage'
		},
		coverageReporter: {
			type : 'text'//,
			//dir : 'coverage/'
		},
		colors: true,
		logLevel: config.LOG_DEBUG,
		htmlReporter: {
			outputFile: 'results/unit-tests.html'
		},
		singleRun: true,
		plugins : [
			'karma-spec-reporter',
			'karma-phantomjs-launcher',
			'karma-jasmine',
			'karma-coverage',
            'karma-htmlfile-reporter',
            'karma-requirejs'
		]
	});
};
<commit_msg>vector and vectortools included<commit_after>module.exports = function (config) {
	config.set({
		basePath : '',
		frameworks: ['jasmine', 'requirejs'],
        files: [
//			'../lib/**/*.js',
//			'../test/spec/*.js'
//            {pattern: 'test-main.js', included: true},
            'test-main.js',
            {pattern: '*test.js', included: false},
            {pattern: 'sqr*.js', included: false},
            {pattern: '**/*vector*.js', included: false},
        ],
        exclude: [
			'lib/requireconfig.js',
			'karma.conf.js'
        ],
		browsers : ['PhantomJS'],
		reporters : ['progress', 'spec', 'coverage', 'html'],
		preprocessors: {
			//'../lib/**/*.js': 'coverage'
			'*.js': 'coverage'
		},
		coverageReporter: {
			type : 'text'//,
			//dir : 'coverage/'
		},
		colors: true,
		logLevel: config.LOG_DEBUG,
		htmlReporter: {
			outputFile: 'results/unit-tests.html'
		},
		singleRun: true,
		plugins : [
			'karma-spec-reporter',
			'karma-phantomjs-launcher',
			'karma-jasmine',
			'karma-coverage',
            'karma-htmlfile-reporter',
            'karma-requirejs'
		]
	});
};
<|endoftext|>


<commit_before>// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['mocha', 'chai', 'sinon-chai', '@angular/cli'],
    plugins: [
      require('karma-mocha'),
      require('karma-chai'),
      require('karma-sinon'),
      require('karma-sinon-chai'),
      require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-mocha-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('karma-istanbul-threshold'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [
      { pattern: 'node_modules/sinon/pkg/sinon.js', instrument: false },
      { pattern: 'node_modules/chai/chai.js', instrument: false },
      { pattern: 'node_modules/sinon-chai/lib/sinon-chai.js', instrument: false },
      { pattern: './src/test.ts', watched: false }
    ],
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime: {
      'text/x-typescript': ['ts','tsx']
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly', 'json' ],
      fixWebpackSourcePaths: true
    },
    istanbulThresholdReporter: {
      src: 'coverage/coverage-final.json',
      reporters: ['text'],
      thresholds: {
        global: {
          statements: 98,
          branches: 77.27,
          lines: 91.89,
          functions: 91.89
        },
        each: {
          statements: 90,
          branches: 50,
          lines: 88.89,
          functions: 66.67
        }
      }
    },
    // mochaReporter: {
    //   output: 'noFailures'
    // },
    angularCli: {
      environment: 'dev'
    },
    reporters: config.angularCli && config.angularCli.codeCoverage
              ? ['progress', 'coverage-istanbul', 'istanbul-threshold']
              : ['progress', 'mocha'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};
<commit_msg>add exclude for test.ts<commit_after>// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['mocha', 'chai', 'sinon-chai', '@angular/cli'],
    plugins: [
      require('karma-mocha'),
      require('karma-chai'),
      require('karma-sinon'),
      require('karma-sinon-chai'),
      require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-mocha-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('karma-istanbul-threshold'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [
      { pattern: 'node_modules/sinon/pkg/sinon.js', instrument: false },
      { pattern: 'node_modules/chai/chai.js', instrument: false },
      { pattern: 'node_modules/sinon-chai/lib/sinon-chai.js', instrument: false },
      { pattern: './src/test.ts', watched: false }
    ],
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime: {
      'text/x-typescript': ['ts','tsx']
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly', 'json' ],
      fixWebpackSourcePaths: true
    },
    istanbulThresholdReporter: {
      src: 'coverage/coverage-final.json',
      reporters: ['text'],
      excludes: ['src/test.ts'],
      thresholds: {
        global: {
          statements: 98,
          branches: 77.27,
          lines: 91.89,
          functions: 91.89
        },
        each: {
          statements: 90,
          branches: 50,
          lines: 88.89,
          functions: 66.67
        }
      }
    },
    // mochaReporter: {
    //   output: 'noFailures'
    // },
    angularCli: {
      environment: 'dev'
    },
    reporters: config.angularCli && config.angularCli.codeCoverage
              ? ['progress', 'coverage-istanbul', 'istanbul-threshold']
              : ['progress', 'mocha'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Wed Apr 26 2017 01:13:44 GMT+0100 (WAT)

module.exports = (config) => {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome', 'Firefox', 'IE', 'Safari', 'Opera'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
};
<commit_msg>chore(task-runner): reconfigure-webpack-&-karma<commit_after>// Karma configuration
// Generated on Wed Apr 26 2017 01:13:44 GMT+0100 (WAT)

module.exports = (config) => {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
        'server/tests/*.js'
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome', 'Firefox', 'Safari'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
};
<|endoftext|>


<commit_before>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: './',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/facebook-g+-sdk-test/fb-sdk.js',
      'app/bower_components/facebook-g+-sdk-test/google-client_plusone.js',
      'app/viewsScripts/**/*.js',
      'app/bower_components/angular/angular.js',
      'app/bower_components/bindonce-master/bindonce.min.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-cookies/angular-cookies.js',
      'app/bower_components/angular-resource/angular-resource.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/bower_components/angular-sanitize/angular-sanitize.js',
      'app/bower_components/angular-md5/angular-md5.min.js',
      'app/bower_components/angular-gettext/dist/angular-gettext.min.js',
      'app/bower_components/ui.bootstrap/ui-bootstrap-tpls-0.9.0.js',
      'app/bower_components/jquery/jquery.js',
      'app/bower_components/jqueryUI/jquery-ui.js',
      'app/bower_components/jquery/jquery.line.js',
      'app/bower_components/sass-bootstrap/js/modal.js',
      'app/bower_components/underscore/underscore.js',
      'app/bower_components/ckeditor/ckeditor.js',
      'app/bower_components/jasmine-jquery/jasmine-jquery-1.3.1.js',
      'app/bower_components/pdfjs/pdf.js',
      'app/bower_components/pdfjs/pdf.worker.js',
      'app/bower_components/crypto/crypter.js',
      'app/bower_components/ngDialog-master/js/ngDialog.js',
      'app/scripts/**/*.js',
      'app/scripts/services/helpers.js',
      'test/spec/frontend/utils.js',
      'test/spec/frontend/*.js'],

    preprocessors: {
      'app/scripts/**/*.js': 'coverage',
      'app/scripts/app.js': 'coverage',

    },

    // list of files / patterns to exclude
    exclude: ['app/scripts/directives/**/*', 'app/scripts/translations.js'],

    reporters: ['coverage', 'dots', 'junit'],

    coverageReporter: {
      type: 'cobertura',
      dir: 'generated/tests/coverage/',
      file: 'coverage.xml'
    },
    junitReporter: {
      outputFile: 'generated/tests/test-results.xml'
    },

    // web server port
    port: 9080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: true

  });
};
<commit_msg>teste unitaires<commit_after>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: './',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/facebook-g+-sdk-test/fb-sdk.js',
      'app/bower_components/facebook-g+-sdk-test/google-client_plusone.js',
      'app/viewsScripts/**/*.js',
      'app/bower_components/angular/angular.js',
      'app/bower_components/bindonce-master/bindonce.min.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-cookies/angular-cookies.js',
      'app/bower_components/angular-resource/angular-resource.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/bower_components/angular-sanitize/angular-sanitize.js',
      'app/bower_components/angular-md5/angular-md5.min.js',
      'app/bower_components/angular-audio/app/angular.audio.js',
      'app/bower_components/angular-gettext/dist/angular-gettext.min.js',
      'app/bower_components/ui.bootstrap/ui-bootstrap-tpls-0.9.0.js',
      'app/bower_components/jquery/jquery.js',
      'app/bower_components/jqueryUI/jquery-ui.js',
      'app/bower_components/jquery/jquery.line.js',
      'app/bower_components/sass-bootstrap/js/modal.js',
      'app/bower_components/underscore/underscore.js',
      'app/bower_components/ckeditor/ckeditor.js',
      'app/bower_components/jasmine-jquery/jasmine-jquery-1.3.1.js',
      'app/bower_components/pdfjs/pdf.js',
      'app/bower_components/pdfjs/pdf.worker.js',
      'app/bower_components/crypto/crypter.js',
      'app/bower_components/ngDialog-master/js/ngDialog.js',
      'app/scripts/**/*.js',
      'app/scripts/services/helpers.js',
      'test/spec/frontend/utils.js',
      'test/spec/frontend/*.js'],

    preprocessors: {
      'app/scripts/**/*.js': 'coverage',
      'app/scripts/app.js': 'coverage'
    },

    // list of files / patterns to exclude
    exclude: ['app/scripts/directives/**/*', 'app/scripts/translations.js'],

    reporters: ['coverage', 'dots', 'junit'],

    coverageReporter: {
      type: 'cobertura',
      dir: 'generated/tests/coverage/',
      file: 'coverage.xml'
    },
    junitReporter: {
      outputFile: 'generated/tests/test-results.xml'
    },

    // web server port
    port: 9080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: true

  });
};
<|endoftext|>


<commit_before>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-resource/angular-resource.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/scripts/*.js',
      'app/scripts/**/*.js',
      'test/mock/**/*.js',
      'test/spec/**/*.js'
    ],

    // list of files / patterns to exclude
    exclude: [],

    // web server port
    port: 8080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['Safari'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};
<commit_msg>Added source for angular-animate.js in karma config file<commit_after>// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'app/bower_components/angular/angular.js',
      'app/bower_components/angular-mocks/angular-mocks.js',
      'app/bower_components/angular-resource/angular-resource.js',
      'app/bower_components/angular-route/angular-route.js',
      'app/bower_components/angular-animate/angular-animate.js',
      'app/scripts/*.js',
      'app/scripts/**/*.js',
      'test/mock/**/*.js',
      'test/spec/**/*.js'
    ],

    // list of files / patterns to exclude
    exclude: [],

    // web server port
    port: 8080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['Safari'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};
<|endoftext|>


<commit_before>// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
var localRun = !process.env.TRAVIS && !process.env.APPVEYOR;

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      // require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [{
      pattern: './src/test.ts',
      watched: false
    }],
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime: {
      'text/x-typescript': ['ts', 'tsx']
    },
    coverageIstanbulReporter: {
      reports: ['html', 'lcovonly'],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: config.angularCli && config.angularCli.codeCoverage ? ['progress', 'coverage-istanbul'] : ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    autoWatchBatchDelay: 1000,
    browsers: [ /*'Chrome',*/ 'PhantomJS'],
    singleRun: !localRun
  });
};
<commit_msg>Another try to fix tests for CI<commit_after>// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
var localRun = !process.env.CI;

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      // require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [{
      pattern: './src/test.ts',
      watched: false
    }],
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime: {
      'text/x-typescript': ['ts', 'tsx']
    },
    coverageIstanbulReporter: {
      reports: ['html', 'lcovonly'],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: config.angularCli && config.angularCli.codeCoverage ? ['progress', 'coverage-istanbul'] : ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    autoWatchBatchDelay: 1000,
    browsers: [ /*'Chrome',*/ 'PhantomJS'],
    singleRun: !localRun
  });
};
<|endoftext|>


<commit_before>module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', 'browserify'],
    files: [
      'test/*'
    ],
    reporters: ['progress', 'coverage'],
    port: 9876,
    runnerPort: 9100,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: true,
    browsers: ['PhantomJS'],
    captureTimeout: 60000,
    singleRun: false,
    browserify: {
      watch: true,
      transform: ['browserify-shim', 'browserify-istanbul']
    },
    preprocessors: {
        'test/*': ['browserify'],
        'lib/*': ['coverage']
    },
    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    }
  });
};
<commit_msg>Add source maps to tests<commit_after>module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', 'browserify'],
    files: [
      'test/*'
    ],
    reporters: ['progress', 'coverage'],
    port: 9876,
    runnerPort: 9100,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: true,
    browsers: ['PhantomJS'],
    captureTimeout: 60000,
    singleRun: false,
    browserify: {
      watch: true,
      debug: true,
      transform: ['browserify-shim', 'browserify-istanbul']
    },
    preprocessors: {
        'test/*': ['browserify'],
        'lib/*': ['coverage']
    },
    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    }
  });
};
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Thu Dec 10 2015 00:03:13 GMT+0000 (GMT)

module.exports = function(config) {
  var configuration = ({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine', 'requirejs'],

    // list of files / patterns to load in the browser
    files: [
      'test-main.js',
      {pattern: 'test-build/src/courtroom/*.js', included: false},
      {pattern: 'test-build/src/courtroom/juries/*.js', included: false},
      {pattern: 'test-build/spec/courtroom/*.spec.js', included: false},
      {pattern: 'test-build/spec/courtroom/courtroom/juries/*.spec.js', included: false}
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'build/*.js': ['coverage'],
      'build/juries/*.js': ['coverage']
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['spec', 'coverage'],

    coverageReporter: {
		reporters: [{type: 'lcov'}, {type: 'text'}],
		dir: "coverage/"
    },

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultanous
    concurrency: Infinity
  });

  if(process.env.TRAVIS){
    configuration.browsers = ['PhantomJS'];
    configuration.reporters.push('coveralls');
    configuration.singleRun = true;
  }

  config.set(configuration);
}
<commit_msg>Final correction of TypeScript test paths<commit_after>// Karma configuration
// Generated on Thu Dec 10 2015 00:03:13 GMT+0000 (GMT)

module.exports = function(config) {
  var configuration = ({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine', 'requirejs'],

    // list of files / patterns to load in the browser
    files: [
      'test-main.js',
      {pattern: 'test-build/src/courtroom/*.js', included: false},
      {pattern: 'test-build/src/courtroom/juries/*.js', included: false},
      {pattern: 'test-build/spec/courtroom/*.spec.js', included: false},
      {pattern: 'test-build/spec/courtroom/juries/*.spec.js', included: false}
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'build/*.js': ['coverage'],
      'build/juries/*.js': ['coverage']
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['spec', 'coverage'],

    coverageReporter: {
		reporters: [{type: 'lcov'}, {type: 'text'}],
		dir: "coverage/"
    },

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultanous
    concurrency: Infinity
  });

  if(process.env.TRAVIS){
    configuration.browsers = ['PhantomJS'];
    configuration.reporters.push('coveralls');
    configuration.singleRun = true;
  }

  config.set(configuration);
}
<|endoftext|>


<commit_before>'use strict';

var path = require('path');
var cwd = require('cwd');

/**
 * Load templates for built-in template types.
 */

module.exports = function(verb) {
  /* deps: readme-includes readme-badges */
  var includes = tryRequire(verb.config.get('includes'), 'readme-includes');
  var badges = tryRequire(verb.config.get('badges'), 'readme-badges');
  var docs = tryRequire(verb.config.get('docs'), cwd('docs'));

  verb.examples('*.js', { cwd: cwd(), cache: true });
  verb.includes('**/*.md', { cwd: includes, cache: true });
  verb.badges('**/*.md', { cwd: badges, cache: true });
  verb.docs('**/*.md', { cwd: docs, cache: true });
};

function tryRequire(name, fallback) {
  if (typeof name === 'string') {
    try {
      return require(name);
    } catch(err) {
      try {
        return require(path.resolve(name));
      } catch(err) {}
      return path.resolve(fallback);
    }
  } else {
    try {
      return require(fallback);
    } catch(err) {
      return path.resolve(fallback);
    }
  }
}
<commit_msg>load built-in templates<commit_after>'use strict';

var utils = require('../../utils');
var path = require('path');
var cwd = require('cwd');

/**
 * Pre-load templates for built-in template types:
 *   | examples
 *   | includes
 *   | badges
 *   | docs
 */

module.exports = function(app) {
  app.examples('*.js', { cwd: cwd(), cache: true });
  app.includes('**/*.md', opts(app, 'includes', 'readme-includes'));
  app.badges('**/*.md', opts(app, 'badges', 'readme-badges'));
  app.docs('**/*.md', opts(app, 'docs'));
};

function opts(app, name, fallback) {
  var paths = app.config.get('templates');
  var defaults = app.option('defaults.templates');
  var options = { cwd: '.', cache: true };

  var fp;
  if (paths.hasOwnProperty(name)) {
    fp = utils.tryRequire(paths[name]);
    if (!fp) fp = path.resolve(paths[name]);
  }

  if (!fp && defaults.hasOwnProperty(name)) {
    fp = utils.tryRequire(defaults[name]);
    if (!fp) fp = path.resolve(defaults[name]);
  }

  options.cwd = fp;
  return options;
}
<|endoftext|>


<commit_before>module.exports = function(HAPnode, config, functions)
{
    var Accessory       = HAPnode.Accessory;
    var Service         = HAPnode.Service;
    var Characteristic  = HAPnode.Characteristic;
    var uuid            = HAPnode.uuid;
    var debug           = HAPnode.debug;

    var module  = {};

    module.newDevice = function(device)
    {
        var self = this;
        const VERA_REF = "urn:upnp-org:serviceId:WindowCovering1";
        const VERA_ACTION =
        {
            DOWN : { ref: "Down", state : 0},
            UP : { ref: "Up", state : 1},
            STOP : { ref: "Stop", state : 2},
        };

        //// Initializing accessory
        self.component = new Accessory(device.name, uuid.generate(`device:windowcovering:${config.cardinality}:${device.id}`));
        self.component.username  = functions.genMac(`device:${config.cardinality}:${device.id}`);
        self.component.pincode   = config.pincode;
        self.component.deviceid  = device.id;

        //// Runtime states
        self.lastPosition = 0; //// Closed by default
        self.currentPositionState = VERA_ACTION.STOP.state; //// STOP by default
        self.currentTargetPosition = VERA_ACTION.DOWN.state; //// DOWN by default

        self.formatUrl = (action) =>  { return `http://${config.veraIP}:3480/data_request?id=lu_action&output_format=xml&DeviceNum=${device.id}&serviceId=${VERA_REF}&action=${action}` };

        self.setAction = (pos, callback) =>
        {
            self.currentTargetPosition = pos;
            const action = (pos === -1 ? VERA_ACTION.STOP : (pos >= self.lastPosition ? VERA_ACTION.UP : VERA_ACTION.DOWN)).ref;
            self.component.getService(Service.WindowCovering).setCharacteristic(Characteristic.PositionState, action.state);

            return HAPnode.request(
                {
                    method:'GET',
                    uri : self.formatUrl(action),
                    resolveWithFullResponse: true}
                )
                .then(function (res)
                {
                    self.component.getService(Service.WindowCovering).setCharacteristic(Characteristic.CurrentPosition, (action === VERA_ACTION.UP.ref ? 100 : 0));
                    self.component.getService(Service.WindowCovering).setCharacteristic(Characteristic.PositionState, 2); //// Stop state
                    self.lastPosition = (action == VERA_ACTION.UP.ref ? 100 : 0);
                    callback(false);
                }).catch(function (err) {
                    HAPnode.debug("Request error:"+err);
                    callback(false);
                });
        };

        self.holdAction = (level, callback) => {
            return self.setAction(-1, callback);
        };

        self.getStatus = () =>
        {
            debug("Making request for device %s", device.name);
            status = functions.getVariable(device.id, 'status','number');
            debug("Status for ", device.name, " is ", status);
            return status;
        };

        self.identify = () =>
        {
            debug("I'm the fucking window covering.");
        };

        //// Starting initilization
        self.component
            .getService(Service.AccessoryInformation)
            .setCharacteristic(Characteristic.Manufacturer, device.manufacturer)
            .setCharacteristic(Characteristic.Model, device.model)
            .setCharacteristic(Characteristic.SerialNumber, "Vera ID: "+device.id);

        //// Runtime Events
        self.component.on('identify', function(paired, callback) {
            self.identify();
            callback(); // success
        });

        // the current position (0-100%)
        // https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js#L493
        self.component
            .addService(Service.WindowCovering, device.name)
            .getCharacteristic(Characteristic.CurrentPosition)
            .on('get', (callback) => { debug(`Position State ${self.lastPosition}`); callback(null, self.lastPosition); });

        // the position state
        // 0 = DECREASING; 1 = INCREASING; 2 = STOPPED;
        // https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js#L1138
        self.component
            .getService(Service.WindowCovering)
            .getCharacteristic(Characteristic.PositionState)
            .on('get', (callback) => { debug(`Position State ${self.currentPositionState}`); callback(null, self.currentPositionState); });

        // the target position (0-100%)
        // https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js#L1564
        self.component
            .getService(Service.WindowCovering)
            .getCharacteristic(Characteristic.TargetPosition)
            .on('get', (callback) => { callback(null, self.currentTargetPosition); })
            .on('set', self.setAction.bind(this));

        self.component
            .getService(Service.WindowCovering)
            .getCharacteristic(Characteristic.HoldPosition)
            .on('get', (callback) => { callback(false, null); })
            .on('set', self.holdAction.bind(this));

        return self.component;
    };

    return module;
};
<commit_msg>Windowcovering accessory: several fixes<commit_after>module.exports = function(HAPnode, config, functions)
{
    var Accessory       = HAPnode.Accessory;
    var Service         = HAPnode.Service;
    var Characteristic  = HAPnode.Characteristic;
    var uuid            = HAPnode.uuid;
    var debug           = HAPnode.debug;

    var module  = {};

    module.newDevice = function(device)
    {
        var self = this;
        const VERA_ACTION =
        {
            DOWN : { ref: "Down", state : 0},
            UP : { ref: "Up", state : 1},
            STOP : { ref: "Stop", state : 2},
        };

        //// Initializing accessory
        self.component = new Accessory(device.name, uuid.generate(`device:windowcovering:${config.cardinality}:${device.id}`));
        self.component.username  = functions.genMac(`device:${config.cardinality}:${device.id}`);
        self.component.pincode   = config.pincode;
        self.component.deviceid  = device.id;

        //// Runtime states
        self.lastPosition = 0; //// Closed by default
        self.currentTargetPosition = undefined;
        self.currentPositionState = VERA_ACTION.STOP.state; //// STOP by default

        self.formatUrl = (targetPosition, action) =>  {
            const base = `http://${config.veraIP}:3480/data_request?id=lu_action&output_format=xml&DeviceNum=${device.id}`;
            // If an absolute position is provided, always send that to vera and let it decide what to do.
            if (typeof targetPosition === 'number' && targetPosition >= 0) {
                return `${base}&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=${targetPosition}`;
            } else if (action === VERA_ACTION.STOP) {
                return `${base}&serviceId=urn:upnp-org:serviceId:WindowCovering1&action=${action.ref}`;
            } else {
                throw new Error(`Invalid input targetPosition=${targetPosition}, action=${action}`);
            }
        };

        self.getLastPosition = () => {
            // Prefer the latest cached value (we poll Vera every ~1s). Fall back to our last-set value.
            const level = functions.getVariable(device.id, 'level', 'number');
            if (typeof level === 'number') {
                return level;
            } else {
                return self.lastPosition;
            }
        };

        self.getTargetPosition = () => {
            if (typeof self.currentTargetPosition === 'number') {
                return self.currentTargetPosition;
            } else {
                return self.getLastPosition();
            }
        };

        self.setAction = (pos, callback) =>
        {
            const lastPosition = self.getLastPosition();
            self.currentTargetPosition = pos;
            let action;
            if (pos === -1 || pos === lastPosition) {
                action = VERA_ACTION.STOP;
            } else if (pos < lastPosition) {
                action = VERA_ACTION.DOWN;
            } else if (pos > lastPosition) {
                action = VERA_ACTION.UP;
            } else {
                throw new Error(`Comparison logic error.`);
            }

            self.component.getService(Service.WindowCovering).setCharacteristic(Characteristic.PositionState, action.state);
            debug("Setting position for %s: %s (%s)", device.name, pos, action);

            return HAPnode.request(
                {
                    method:'GET',
                    uri : self.formatUrl(pos, action),
                    resolveWithFullResponse: true}
                )
                .then(function (res)
                {
                    self.currentPositionState = VERA_ACTION.STOP.state
                    self.currentTargetPosition = undefined;
                    self.lastPosition = pos;
                    self.component.getService(Service.WindowCovering).setCharacteristic(Characteristic.CurrentPosition, pos);
                    self.component.getService(Service.WindowCovering).setCharacteristic(Characteristic.PositionState, self.currentPositionState);
                    callback(false);
                }).catch(function (err) {
                    self.currentPositionState = VERA_ACTION.STOP.state
                    self.currentTargetPosition = undefined;
                    HAPnode.debug("Request error:"+err);
                    callback(false);
                });
        };

        self.holdAction = (level, callback) => {
            return self.setAction(-1, callback);
        };

        self.getStatus = () =>
        {
            debug("Making request for device %s", device.name);
            status = functions.getVariable(device.id, 'status','number');
            debug("Status for ", device.name, " is ", status);
            return status;
        };

        self.identify = () =>
        {
            debug("I'm the fucking window covering.");
        };

        //// Starting initilization
        self.component
            .getService(Service.AccessoryInformation)
            .setCharacteristic(Characteristic.Manufacturer, device.manufacturer)
            .setCharacteristic(Characteristic.Model, device.model)
            .setCharacteristic(Characteristic.SerialNumber, "Vera ID: "+device.id);

        //// Runtime Events
        self.component.on('identify', function(paired, callback) {
            self.identify();
            callback(); // success
        });

        // the current position (0-100%)
        // https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js#L493
        self.component
            .addService(Service.WindowCovering, device.name)
            .getCharacteristic(Characteristic.CurrentPosition)
            .on('get', (callback) => { debug(`${device.name} Position ${self.getLastPosition()}`); callback(null, self.getLastPosition()); });

        // the position state
        // 0 = DECREASING; 1 = INCREASING; 2 = STOPPED;
        // https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js#L1138
        self.component
            .getService(Service.WindowCovering)
            .getCharacteristic(Characteristic.PositionState)
            .on('get', (callback) => { debug(`${device.name} Position State ${self.currentPositionState}`); callback(null, self.currentPositionState); });

        // the target position (0-100%)
        // https://github.com/KhaosT/HAP-NodeJS/blob/master/lib/gen/HomeKitTypes.js#L1564
        self.component
            .getService(Service.WindowCovering)
            .getCharacteristic(Characteristic.TargetPosition)
            .on('get', (callback) => { debug(`${device.name} Target Position ${self.getTargetPosition()}`);callback(null, self.getTargetPosition()); })
            .on('set', self.setAction.bind(this));

        self.component
            .getService(Service.WindowCovering)
            .getCharacteristic(Characteristic.HoldPosition)
            .on('get', (callback) => { callback(false, null); })
            .on('set', self.holdAction.bind(this));

        return self.component;
    };

    return module;
};
<|endoftext|>


<commit_before>// TODO: Add a timeout.

/**
 * Invoke each handler in turn until the list is exhausted or the request has
 * been ended.
 */
function invokeHandlers(handlers, req, res, callback) {
  var nextHandler = handlers[0];
  var remaining = handlers.slice(1);

  var next = function(err) {
    if (err) {
      callback(err);
    } else if (res.ended) {
      // The request has finished; we're done.
      callback();
    } else {
      // Call the remaining handlers.
      invokeHandlers(remaining, res, req, callback);
    }
  };

  if (nextHandler) {
    try {
      nextHandler.call(res, req, next);
    } catch (err) {
      callback(err);
    }
  } else {
    callback();
  }
}

module.exports = invokeHandlers;
<commit_msg>Correct argument order<commit_after>// TODO: Add a timeout.

/**
 * Invoke each handler in turn until the list is exhausted or the request has
 * been ended.
 */
function invokeHandlers(handlers, req, res, callback) {
  var nextHandler = handlers[0];
  var remaining = handlers.slice(1);

  var next = function(err) {
    if (err) {
      callback(err);
    } else if (res.ended) {
      // The request has finished; we're done.
      callback();
    } else {
      // Call the remaining handlers.
      invokeHandlers(remaining, req, res, callback);
    }
  };

  if (nextHandler) {
    try {
      nextHandler.call(res, req, next);
    } catch (err) {
      callback(err);
    }
  } else {
    callback();
  }
}

module.exports = invokeHandlers;
<|endoftext|>


<commit_before>pageflow.pageType.register('video', _.extend({

  enhance: function(pageElement, configuration) {
    pageElement.find('.contentText').before(pageElement.find('.page_header'));
    this._initVideoPlayer(pageElement, configuration);
  },

  preload: function(pageElement, configuration) {
    return pageflow.preload.backgroundImage(pageElement.find('.background_image'));
  },

  prepare: function(pageElement, configuration) {
    this.videoPlayer.ensureCreated();
  },

  unprepare: function(pageElement, configuration) {
    this.videoPlayer.scheduleDispose();
  },

  activating: function(pageElement, configuration) {
    var videoPlayer = this.videoPlayer;

    // for SkipLinks
    $('#firstContent').attr("id","");
    var firstContentElement = pageElement.find('*[tabindex="4"], a');
    $(firstContentElement[0]).attr('id','firstContent');
    //

    this.videoPlayer.ensureCreated();

    if (pageflow.browser.has('mobile platform')) {
      this.videoPlayer.showPosterImage();
    }

    $('body').on('keyup', function(e) {
      if(e.keyCode == 32){
        if(videoPlayer.paused()) {
          videoPlayer.play();
        }
        else {
          videoPlayer.pause();
        }
      }
    });
  },

  activated: function(pageElement, configuration) {
    this.pageElement = pageElement;
    var videoPlayer = this.videoPlayer;
    var that = this;

    if (pageflow.browser.has('mobile platform')) {
       videoPlayer.src(videoPlayer.srcFromOptions()); // needed for iOS
    }
    else {
      videoPlayer.prebuffer().done(function() {
        videoPlayer.hidePosterImage();

        if (configuration.autoplay !== false) {
          that.fadeInTimeout = setTimeout(function() {
            videoPlayer.playAndFadeIn(1000);
          }, 1000);
        }
      });
    }
  },

  deactivating: function(pageElement, configuration) {
    clearTimeout(this.fadeInTimeout);
    this.fadeSound(this.videoPlayer, 0, 400);
    this.stopListening();
    $('body').off('keyup');
  },

  deactivated: function(pageElement, configuration) {
    if (pageflow.browser.has('mobile platform')) {
      this.videoPlayer.showPosterImage();
    }
    this.videoPlayer.pause();
    this.videoPlayer.scheduleDispose();
  },

  update: function(pageElement, configuration) {
    pageElement.find('h2 .tagline').text(configuration.get('tagline') || '');
    pageElement.find('h2 .title').text(configuration.get('title') || '');
    pageElement.find('h2 .subtitle').text(configuration.get('subtitle') || '');

    pageElement.find('p').html(configuration.get('text') || '');

    this.updateInfoBox(pageElement, configuration);
    this.updateCommonPageCssClasses(pageElement, configuration);

    pageElement.find('.shadow').css({opacity: configuration.get('gradient_opacity') / 100});

    this.updateVideoPoster(pageElement, configuration.getVideoPosterUrl());
  },

  embeddedEditorViews: function() {
    return {
      '.videoWrapper': {
        view: pageflow.LazyVideoEmbeddedView,
        options: {
          propertyName: 'video_file_id'
        }
      }
    };
  },

  _initVideoPlayer: function(pageElement, configuration) {
    var videoPlayer = new pageflow.VideoPlayer.Lazy(pageElement.find('[data-template=video]'), {
      bufferUnderrunWaiting: true,
      controls: true,
      customControlsOnMobile: true,

      volumeFading: true,
      hooks: pageflow.atmo.createMediaPlayerHooks(configuration),

      mediaEvents: true,
      context: {
        page: pageElement.page('instance')
      },

      width: '100%',
      height: '100%'
    });

    this.videoPlayer = videoPlayer;
    pageElement.find('.videoWrapper').data('videoPlayer', videoPlayer);

    videoPlayer.ready(function() {
      videoPlayer.showPosterImage();

      var addInfoBox = pageElement.find('.add_info_box'),
          controls = pageElement.find('.controls'),
          controlBar = pageElement.find('.vjs-control-bar'),
          playButton = pageElement.find('.vjs-play-control'),
          loadingSpinner = pageElement.find('.vjs-loading-spinner'),
          poster = pageElement.find('.vjs-poster'),
          video =  pageElement.find('video');

      controlBar.appendTo(controls);

      var additionalControlsHtml = '

';

      $(additionalControlsHtml).appendTo(controlBar);
      //pageElement.find('.scroller').after(controls);

      controlBar.addClass('vjs-default-skin vjs-player');
      playButton.before(loadingSpinner);
      playButton.attr('tabindex','4');

      playButton.on({
        'mousedown touchstart': function() {
          $(this).addClass('pressed');
        },
        'mouseup touchend': function() {
          $(this).removeClass('pressed');
        }
      });

      videoPlayer.on('bufferunderrun', function() {
        loadingSpinner.addClass('showing-for-underrun');
      });

      videoPlayer.on('timeupdate', function() {
        loadingSpinner.removeClass('showing-for-underrun');
      });

      if (pageflow.browser.has('phone platform')) {
        // alternate poster image handling
        $("

").appendTo(pageElement.find(".videoWrapper"));
        poster.removeClass('vjs-poster').addClass('vjs-poster-mobile');

        // listening for exit fullscreen to force pausing
        $(document).on("fullscreenchange mozfullscreenchange webkitfullscreenchange", function() {
          if (!document.fullscreenElement && !document.mozFullScreen && !document.webkitIsFullScreen) {
            videoPlayer.pause();
          }
        });
      }

      var timeout, scrollIndicatorTimeout,
          scrollIndicator = $('.entry .scroll_indicator'),
          pageContent = pageElement.find('.scroller, .controls, .shadow');

      videoPlayer.on("pause", function() {
        pageContent.addClass('lock-showing');

        scrollIndicator.removeClass('faded');
        clearTimeout(scrollIndicatorTimeout);
      });

      videoPlayer.on('beforeplay', function() {
        loadingSpinner.addClass('showing-for-underrun');
      });

      videoPlayer.on("play", function() {
        pageContent.removeClass('lock-showing');

        scrollIndicatorTimeout = setTimeout(function() {
          scrollIndicator.addClass('faded');
        }, 2000);
      });

      videoPlayer.on("ended", function() {
        scrollIndicator.removeClass('faded');
        clearTimeout(scrollIndicatorTimeout);

        if (pageflow.browser.has('mobile platform')) {
          videoPlayer.showPosterImage();
        }

        if (pageElement.hasClass('active') && configuration.auto_change_page_on_ended) {
          pageflow.slides.next();
        }
      });

      pageElement.on('mousemove', autoHideControls);
      $('body').on('keydown', autoHideControls);
      pageElement.find('.content').on('touchstart', autoHideControls);

      pageElement.find('.volume-control').volumeSlider({
        orientation: 'v'
      });

      pageElement.find('.player_mute').muteButton();
      pageElement.find('.player_skip').skipPageButton();

      function autoHideControls() {
        showControls();
        if (!pageflow.browser.has('phone platform')) {
          clearTimeout(timeout);
          timeout = setTimeout(hideControls, 2000);
        }
      }

      function hideControls() {
        if (!videoPlayer.paused()) {
          pageContent.addClass('fade-out').removeClass('fade-in');
        }
      }

      function showControls() {
        pageContent.addClass('fade-in').removeClass('fade-out');
      }
    });
  }
}, pageflow.volumeFade, pageflow.videoHelpers, pageflow.infoBox, pageflow.commonPageCssClasses));
<commit_msg>Focussed CSS Class For Video Player Controls<commit_after>pageflow.pageType.register('video', _.extend({

  enhance: function(pageElement, configuration) {
    pageElement.find('.contentText').before(pageElement.find('.page_header'));
    this._initVideoPlayer(pageElement, configuration);
  },

  preload: function(pageElement, configuration) {
    return pageflow.preload.backgroundImage(pageElement.find('.background_image'));
  },

  prepare: function(pageElement, configuration) {
    this.videoPlayer.ensureCreated();
  },

  unprepare: function(pageElement, configuration) {
    this.videoPlayer.scheduleDispose();
  },

  activating: function(pageElement, configuration) {
    var videoPlayer = this.videoPlayer;

    // for SkipLinks
    $('#firstContent').attr("id","");
    var firstContentElement = pageElement.find('*[tabindex="4"], a');
    $(firstContentElement[0]).attr('id','firstContent');
    //

    this.videoPlayer.ensureCreated();

    if (pageflow.browser.has('mobile platform')) {
      this.videoPlayer.showPosterImage();
    }

    $('body').on('keyup', function(e) {
      if(e.keyCode == 32){
        if(videoPlayer.paused()) {
          videoPlayer.play();
        }
        else {
          videoPlayer.pause();
        }
      }
    });
  },

  activated: function(pageElement, configuration) {
    this.pageElement = pageElement;
    var videoPlayer = this.videoPlayer;
    var that = this;

    if (pageflow.browser.has('mobile platform')) {
       videoPlayer.src(videoPlayer.srcFromOptions()); // needed for iOS
    }
    else {
      videoPlayer.prebuffer().done(function() {
        videoPlayer.hidePosterImage();

        if (configuration.autoplay !== false) {
          that.fadeInTimeout = setTimeout(function() {
            videoPlayer.playAndFadeIn(1000);
          }, 1000);
        }
      });
    }
  },

  deactivating: function(pageElement, configuration) {
    clearTimeout(this.fadeInTimeout);
    this.fadeSound(this.videoPlayer, 0, 400);
    this.stopListening();
    $('body').off('keyup');
  },

  deactivated: function(pageElement, configuration) {
    if (pageflow.browser.has('mobile platform')) {
      this.videoPlayer.showPosterImage();
    }
    this.videoPlayer.pause();
    this.videoPlayer.scheduleDispose();
  },

  update: function(pageElement, configuration) {
    pageElement.find('h2 .tagline').text(configuration.get('tagline') || '');
    pageElement.find('h2 .title').text(configuration.get('title') || '');
    pageElement.find('h2 .subtitle').text(configuration.get('subtitle') || '');

    pageElement.find('p').html(configuration.get('text') || '');

    this.updateInfoBox(pageElement, configuration);
    this.updateCommonPageCssClasses(pageElement, configuration);

    pageElement.find('.shadow').css({opacity: configuration.get('gradient_opacity') / 100});

    this.updateVideoPoster(pageElement, configuration.getVideoPosterUrl());
  },

  embeddedEditorViews: function() {
    return {
      '.videoWrapper': {
        view: pageflow.LazyVideoEmbeddedView,
        options: {
          propertyName: 'video_file_id'
        }
      }
    };
  },

  _initVideoPlayer: function(pageElement, configuration) {
    var videoPlayer = new pageflow.VideoPlayer.Lazy(pageElement.find('[data-template=video]'), {
      bufferUnderrunWaiting: true,
      controls: true,
      customControlsOnMobile: true,

      volumeFading: true,
      hooks: pageflow.atmo.createMediaPlayerHooks(configuration),

      mediaEvents: true,
      context: {
        page: pageElement.page('instance')
      },

      width: '100%',
      height: '100%'
    });

    this.videoPlayer = videoPlayer;
    pageElement.find('.videoWrapper').data('videoPlayer', videoPlayer);

    videoPlayer.ready(function() {
      videoPlayer.showPosterImage();

      var addInfoBox = pageElement.find('.add_info_box'),
          controls = pageElement.find('.controls'),
          controlBar = pageElement.find('.vjs-control-bar'),
          playButton = pageElement.find('.vjs-play-control'),
          loadingSpinner = pageElement.find('.vjs-loading-spinner'),
          poster = pageElement.find('.vjs-poster'),
          video =  pageElement.find('video');

      controlBar.appendTo(controls);

      var additionalControlsHtml = '

';

      $(additionalControlsHtml).appendTo(controlBar);
      //pageElement.find('.scroller').after(controls);

      controlBar.addClass('vjs-default-skin vjs-player');
      playButton.before(loadingSpinner);
      playButton.attr('tabindex','4');

      playButton.on({
        'mousedown touchstart': function() {
          $(this).addClass('pressed');
        },
        'mouseup touchend': function() {
          $(this).removeClass('pressed');
        }
      });

      controls.find('a, [tabindex]').on({
        focus: function() {
          controls.addClass('focussed');
        },

        blur: function() {
          controls.removeClass('focussed');
        }
      });

      videoPlayer.on('bufferunderrun', function() {
        loadingSpinner.addClass('showing-for-underrun');
      });

      videoPlayer.on('timeupdate', function() {
        loadingSpinner.removeClass('showing-for-underrun');
      });

      if (pageflow.browser.has('phone platform')) {
        // alternate poster image handling
        $("

").appendTo(pageElement.find(".videoWrapper"));
        poster.removeClass('vjs-poster').addClass('vjs-poster-mobile');

        // listening for exit fullscreen to force pausing
        $(document).on("fullscreenchange mozfullscreenchange webkitfullscreenchange", function() {
          if (!document.fullscreenElement && !document.mozFullScreen && !document.webkitIsFullScreen) {
            videoPlayer.pause();
          }
        });
      }

      var timeout, scrollIndicatorTimeout,
          scrollIndicator = $('.entry .scroll_indicator'),
          pageContent = pageElement.find('.scroller, .controls, .shadow');

      videoPlayer.on("pause", function() {
        pageContent.addClass('lock-showing');

        scrollIndicator.removeClass('faded');
        clearTimeout(scrollIndicatorTimeout);
      });

      videoPlayer.on('beforeplay', function() {
        loadingSpinner.addClass('showing-for-underrun');
      });

      videoPlayer.on("play", function() {
        pageContent.removeClass('lock-showing');

        scrollIndicatorTimeout = setTimeout(function() {
          scrollIndicator.addClass('faded');
        }, 2000);
      });

      videoPlayer.on("ended", function() {
        scrollIndicator.removeClass('faded');
        clearTimeout(scrollIndicatorTimeout);

        if (pageflow.browser.has('mobile platform')) {
          videoPlayer.showPosterImage();
        }

        if (pageElement.hasClass('active') && configuration.auto_change_page_on_ended) {
          pageflow.slides.next();
        }
      });

      pageElement.on('mousemove', autoHideControls);
      $('body').on('keydown', autoHideControls);
      pageElement.find('.content').on('touchstart', autoHideControls);

      pageElement.find('.volume-control').volumeSlider({
        orientation: 'v'
      });

      pageElement.find('.player_mute').muteButton();
      pageElement.find('.player_skip').skipPageButton();

      function autoHideControls() {
        showControls();
        if (!pageflow.browser.has('phone platform')) {
          clearTimeout(timeout);
          timeout = setTimeout(hideControls, 2000);
        }
      }

      function hideControls() {
        if (!videoPlayer.paused()) {
          pageContent.addClass('fade-out').removeClass('fade-in');
        }
      }

      function showControls() {
        pageContent.addClass('fade-in').removeClass('fade-out');
      }
    });
  }
}, pageflow.volumeFade, pageflow.videoHelpers, pageflow.infoBox, pageflow.commonPageCssClasses));
<|endoftext|>


<commit_before>const GetPocket = require('node-getpocket');

const REDIRECT_URI = 'http://janis-kra.github.io/Pickpocket';
const ERR_MODULE_NOT_INITIALIZED = 'module not initialized correctly ' +
  '(pass your consumer key as a parameter)';
const ERR_NO_REQUEST_TOKEN = 'no request token given - get one by calling obtainRequestToken';

const createObtainRequestToken = function createObtainRequestToken (getpocket = {}) {
  /**
   * Gets a request token from the getpocket webservice endpoint
   * @return {Promise} a promise that either resolves with the token string, or
   * rejects with an error message
   */
  return function obtainRequestToken () {
    // FIXME Promise { <pending> }
    return new Promise((resolve, reject) => {
      if (getpocket === {}) {
        reject(ERR_MODULE_NOT_INITIALIZED);
      }
      getpocket.getRequestToken(
        { redirect_uri: REDIRECT_URI },
        (err, resp, body) => {
          if (err) {
            reject(`getTokenRequest failed: ${err}`);
          } else {
            const json = JSON.parse(body);
            const requestToken = json.code;
            resolve(requestToken);
          }
        }
      );
    });
  };
};

const createGetAuthorizeURL = function createGetAuthorizeURL (getpocket = {}) {
  /**
   * Builds a URL that can be used to authorize the application with the
   * getpocket service.
   * @return {string} the url that can be used to authorize the application
   */
  return function getAuthorizationURL ({ requestToken = '' } = {}) {
    if (getpocket === {}) {
      throw new Error(ERR_MODULE_NOT_INITIALIZED);
    }
    if (requestToken === '') {
      throw new Error(ERR_NO_REQUEST_TOKEN);
    }
    return getpocket.getAuthorizeURL({
      consumer_key: getpocket.config.consumer_key,
      request_token: requestToken
    });
  };
};

const createObtainAccessToken = function createObtainAccessToken (getpocket = {}) {
  return function obtainAccessToken ({ requestToken = '' } = {}) {
    return new Promise((resolve, reject) => {
      if (requestToken === '') {
        reject(ERR_NO_REQUEST_TOKEN);
      }
      const params = {
        request_token: requestToken
      };
      getpocket.getAccessToken(params, (err, resp, body) => {
        if (err) {
          reject(`Oops; getTokenRequest failed: ${err}`);
        } else {
        // your access token is in body.access_token
          const json = JSON.parse(body);
          const accessToken = json.access_token;
          resolve(accessToken);
        }
      });
    });
  };
};

module.exports = ({
  consumerKey = '',
  log = console.log
} = {}) => {
  if (typeof consumerKey !== 'string' || consumerKey === '') {
    throw new Error('no consumer key given, remember to pass it as an argument to each api call');
  }

  const config = {
    consumer_key: consumerKey,
    redirect_uri: REDIRECT_URI
  };
  const getpocket = new GetPocket(config);
  log(`Module successfully initialized using consumer key ${consumerKey}`);

  return {
    getAuthorizationURL: createGetAuthorizeURL(getpocket),
    obtainAccessToken: createObtainAccessToken(getpocket),
    obtainRequestToken: createObtainRequestToken(getpocket)
  };
};
<commit_msg>All tests passing :white_check_mark:<commit_after>const GetPocket = require('node-getpocket');

const REDIRECT_URI = 'http://janis-kra.github.io/Pickpocket';
const ERR_MODULE_NOT_INITIALIZED = 'module not initialized correctly ' +
  '(pass your consumer key as a parameter)';
const ERR_NO_REQUEST_TOKEN = 'no (valid) request token given - get one ' +
  'by calling obtainRequestToken';

const createObtainRequestToken = function createObtainRequestToken (getpocket = {}) {
  /**
   * Gets a request token from the getpocket webservice endpoint
   * @return {Promise} a promise that either resolves with the token string, or
   * rejects with an error message
   */
  return function obtainRequestToken () {
    // FIXME Promise { <pending> }
    return new Promise((resolve, reject) => {
      if (getpocket === {}) {
        reject(ERR_MODULE_NOT_INITIALIZED);
      }
      getpocket.getRequestToken(
        { redirect_uri: REDIRECT_URI },
        (err, resp, body) => {
          if (err) {
            reject(`getTokenRequest failed: ${err}`);
          } else {
            const json = JSON.parse(body);
            const requestToken = json.code;
            resolve(requestToken);
          }
        }
      );
    });
  };
};

const createGetAuthorizeURL = function createGetAuthorizeURL (getpocket = {}) {
  /**
   * Builds a URL that can be used to authorize the application with the
   * getpocket service.
   * @return {string} the url that can be used to authorize the application
   */
  return function getAuthorizationURL ({ requestToken = '' } = {}) {
    if (getpocket === {}) {
      throw new Error(ERR_MODULE_NOT_INITIALIZED);
    }
    if (typeof requestToken !== 'string' || requestToken === '') {
      throw new Error(ERR_NO_REQUEST_TOKEN);
    }
    return getpocket.getAuthorizeURL({
      consumer_key: getpocket.config.consumer_key,
      request_token: requestToken
    });
  };
};

const createObtainAccessToken = function createObtainAccessToken (getpocket = {}) {
  return function obtainAccessToken ({ requestToken = '' } = {}) {
    return new Promise((resolve, reject) => {
      if (typeof requestToken !== 'string' || requestToken === '') {
        throw new Error(ERR_NO_REQUEST_TOKEN);
      }
      const params = {
        request_token: requestToken
      };
      getpocket.getAccessToken(params, (err, resp, body) => {
        if (err) {
          reject(`Oops; getTokenRequest failed: ${err}`);
        } else {
        // your access token is in body.access_token
          const json = JSON.parse(body);
          const accessToken = json.access_token;
          resolve(accessToken);
        }
      });
    });
  };
};

module.exports = ({
  consumerKey = '',
  log = console.log
} = {}) => {
  if (typeof consumerKey !== 'string' || consumerKey === '') {
    throw new Error('no consumer key given, remember to pass it as an argument to each api call');
  }

  const config = {
    consumer_key: consumerKey,
    redirect_uri: REDIRECT_URI
  };
  const getpocket = new GetPocket(config);
  log(`Module successfully initialized using consumer key ${consumerKey}`);

  return {
    getAuthorizationURL: createGetAuthorizeURL(getpocket),
    obtainAccessToken: createObtainAccessToken(getpocket),
    obtainRequestToken: createObtainRequestToken(getpocket)
  };
};
<|endoftext|>


<commit_before>const GetPocket = require('node-getpocket');

const REDIRECT_URI = 'http://janis-kra.github.io/Pickpocket';
const ERR_MODULE_NOT_INITIALIZED = 'module not initialized correctly ' +
  '(pass your consumer key as a parameter)';
const ERR_NO_REQUEST_TOKEN = 'no (valid) request token given - get one ' +
  'by calling obtainRequestToken';

const createObtainRequestToken = function createObtainRequestToken (getpocket = {}) {
  /**
   * Gets a request token from the getpocket webservice endpoint
   * @return {Promise} a promise that either resolves with the token string, or
   * rejects with an error message
   */
  return function obtainRequestToken () {
    // FIXME Promise { <pending> }
    return new Promise((resolve, reject) => {
      if (getpocket === {}) {
        reject(ERR_MODULE_NOT_INITIALIZED);
      }
      getpocket.getRequestToken(
        { redirect_uri: REDIRECT_URI },
        (err, resp, body) => {
          if (err) {
            reject(`getTokenRequest failed: ${err}`);
          } else {
            const json = JSON.parse(body);
            const requestToken = json.code;
            resolve(requestToken);
          }
        }
      );
    });
  };
};

const createGetAuthorizeURL = function createGetAuthorizeURL (getpocket = {}) {
  /**
   * Builds a URL that can be used to authorize the application with the
   * getpocket service.
   * @return {string} the url that can be used to authorize the application
   */
  return function getAuthorizationURL ({ requestToken = '' } = {}) {
    if (getpocket === {}) {
      throw new Error(ERR_MODULE_NOT_INITIALIZED);
    }
    if (typeof requestToken !== 'string' || requestToken === '') {
      throw new Error(ERR_NO_REQUEST_TOKEN);
    }
    return getpocket.getAuthorizeURL({
      consumer_key: getpocket.config.consumer_key,
      request_token: requestToken
    });
  };
};

const createObtainAccessToken = function createObtainAccessToken (getpocket = {}) {
  return function obtainAccessToken ({ requestToken = '' } = {}) {
    return new Promise((resolve, reject) => {
      if (typeof requestToken !== 'string' || requestToken === '') {
        throw new Error(ERR_NO_REQUEST_TOKEN);
      }
      const params = {
        request_token: requestToken
      };
      getpocket.getAccessToken(params, (err, resp, body) => {
        if (err) {
          reject(`Oops; getTokenRequest failed: ${err}`);
        } else {
        // your access token is in body.access_token
          const json = JSON.parse(body);
          const accessToken = json.access_token;
          resolve(accessToken);
        }
      });
    });
  };
};

module.exports = ({
  consumerKey = '',
  log = console.log
} = {}) => {
  if (typeof consumerKey !== 'string' || consumerKey === '') {
    throw new Error('no consumer key given, remember to pass it as an argument to each api call');
  }

  const config = {
    consumer_key: consumerKey,
    redirect_uri: REDIRECT_URI
  };
  const getpocket = new GetPocket(config);
  log(`Module successfully initialized using consumer key ${consumerKey}`);

  return {
    getAuthorizationURL: createGetAuthorizeURL(getpocket),
    obtainAccessToken: createObtainAccessToken(getpocket),
    obtainRequestToken: createObtainRequestToken(getpocket)
  };
};
<commit_msg>Reject all promises with an error instead of just a string<commit_after>// TODO Add flow?
const GetPocket = require('node-getpocket');

const REDIRECT_URI = 'http://janis-kra.github.io/Pickpocket';
const ERR_MODULE_NOT_INITIALIZED = 'module not initialized correctly ' +
  '(pass your consumer key as a parameter)';
const ERR_NO_REQUEST_TOKEN = 'no (valid) request token given - get one ' +
  'by calling obtainRequestToken';

const createObtainRequestToken = function createObtainRequestToken (getpocket = {}) {
  /**
   * Gets a request token from the getpocket webservice endpoint
   * @return {Promise} a promise that either resolves with the token string, or
   * rejects with an error message
   */
  return function obtainRequestToken () {
    return new Promise((resolve, reject) => {
      if (getpocket === {}) {
        reject(new Error(ERR_MODULE_NOT_INITIALIZED));
      }
      getpocket.getRequestToken(
        { redirect_uri: REDIRECT_URI },
        (err, resp, body) => {
          if (err) {
            reject(new Error(err));
          } else {
            const json = JSON.parse(body);
            const requestToken = json.code;
            resolve(requestToken);
          }
        }
      );
    });
  };
};

const createGetAuthorizeURL = function createGetAuthorizeURL (getpocket = {}) {
  /**
   * Builds a URL that can be used to authorize the application with the
   * getpocket service.
   * @return {string} the url that can be used to authorize the application
   */
  return function getAuthorizationURL ({ requestToken = '' } = {}) {
    if (getpocket === {}) {
      throw new Error(ERR_MODULE_NOT_INITIALIZED);
    }
    if (typeof requestToken !== 'string' || requestToken === '') {
      throw new Error(ERR_NO_REQUEST_TOKEN);
    }
    return getpocket.getAuthorizeURL({
      consumer_key: getpocket.config.consumer_key,
      request_token: requestToken
    });
  };
};

const createObtainAccessToken = function createObtainAccessToken (getpocket = {}) {
  return function obtainAccessToken ({ requestToken = '' } = {}) {
    return new Promise((resolve, reject) => {
      if (typeof requestToken !== 'string' || requestToken === '') {
        throw new Error(ERR_NO_REQUEST_TOKEN);
      }
      const params = {
        request_token: requestToken
      };
      getpocket.getAccessToken(params, (err, resp, body) => {
        if (err) {
          reject(new Error(err));
        } else if (!body.startsWith('{')) {
          reject(new Error(ERR_NO_REQUEST_TOKEN));
        } else {
          const json = JSON.parse(body);
          const accessToken = json.access_token;
          resolve(accessToken);
        }
      });
    });
  };
};

module.exports = ({
  consumerKey = '',
  log = console.log
} = {}) => {
  if (typeof consumerKey !== 'string' || consumerKey === '') {
    throw new Error('no consumer key given, remember to pass it as an argument to each api call');
  }

  const config = {
    consumer_key: consumerKey,
    redirect_uri: REDIRECT_URI
  };
  const getpocket = new GetPocket(config);
  log(`Module successfully initialized using consumer key ${consumerKey}`);

  return {
    getAuthorizationURL: createGetAuthorizeURL(getpocket),
    obtainAccessToken: createObtainAccessToken(getpocket),
    obtainRequestToken: createObtainRequestToken(getpocket)
  };
};
<|endoftext|>