How to use the yargs.argv.watch function in yargs

To help you get started, we’ve selected a few yargs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AlexSergey / rocket-next / karma.conf.js View on Github external
// possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['spec'],
        port: 9876,
        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_DEBUG,
        logLevel: config.LOG_DISABLE,
        // 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: !argv.watch,
        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: argv.watch,
    });
}
github Venryx / DebateMap / Scripts / Build / karma.conf.js View on Github external
const config = require('../config')
const webpackConfig = require('./webpack.config')
const debug = require('debug')('app:karma')

debug('Creating configuration.')
const karmaConfig = {
  basePath : '../', // project root in relation to bin/karma.js
  files    : [
    {
      pattern  : `./${config.dir_test}/test-bundler.js`,
      watched  : false,
      served   : true,
      included : true
    }
  ],
  singleRun     : !argv.watch,
  frameworks    : ['mocha'],
  reporters     : ['mocha'],
  preprocessors : {
    [`${config.dir_test}/test-bundler.js`] : ['webpack']
  },
  browsers : ['PhantomJS'],
  webpack  : {
    devtool : 'cheap-module-source-map',
    resolve : Object.assign({}, webpackConfig.resolve, {
      alias : Object.assign({}, webpackConfig.resolve.alias, {
        sinon : 'sinon/pkg/sinon.js'
      })
    }),
    plugins : webpackConfig.plugins,
    module  : {
      noParse : [
github RD17 / ambar / FrontEnd / config / index.js View on Github external
************************************************/

// ------------------------------------
// Environment
// ------------------------------------
// N.B.: globals added here must _also_ be added to .eslintrc
config.globals = {
  'process.env'  : {
    'NODE_ENV' : JSON.stringify(config.env)
  },
  'NODE_ENV'     : config.env,
  '__DEV__'      : config.env === 'development',
  '__PROD__'     : config.env === 'production',
  '__TEST__'     : config.env === 'test',
  '__DEBUG__'    : config.env === 'development' && !argv.no_debug,
  '__COVERAGE__' : !argv.watch && config.env === 'test',
  '__BASENAME__' : JSON.stringify(process.env.BASENAME || '')
}

// ------------------------------------
// Validate Vendor Dependencies
// ------------------------------------
const pkg = require('../package.json')

config.compiler_vendor = config.compiler_vendor
  .filter((dep) => {
    if (pkg.dependencies[dep]) return true

    debug(
      `Package "${dep}" was not found as an npm dependency in package.json; ` +
      `it won't be included in the webpack vendor bundle.
       Consider removing it from vendor_dependencies in ~/config/index.js`
github pdaddyo / soundbounce-v2 / build / karma.conf.js View on Github external
const debug = _debug('soundbounce:karma');
debug('Create configuration.');

const karmaConfig = {
	basePath: '../', // project root in relation to bin/karma.js
	files: [
		'./node_modules/phantomjs-polyfill/bind-polyfill.js',
		{
			pattern: `./${config.dir_test}/test-bundler.js`,
			watched: false,
			served: true,
			included: true
		}
	],
	singleRun: !argv.watch,
	frameworks: ['mocha'],
	reporters: ['mocha'],
	preprocessors: {
		[`${config.dir_test}/test-bundler.js`]: ['webpack']
	},
	browsers: ['PhantomJS'],
	webpack: {
		devtool: 'cheap-module-source-map',
		resolve: {
			...webpackConfig.resolve,
			alias: {
				...webpackConfig.resolve.alias,
				sinon: 'sinon/pkg/sinon.js'
			}
		},
		plugins: webpackConfig.plugins,
github keplr-io / hera / client / build / webpack.config.js View on Github external
filename : 'index.html',
    inject   : 'body',
    minify   : {
      collapseWhitespace : true
    }
  }),
  new webpack.DefinePlugin({
    HERA_HOST: JSON.stringify(
      process.env.HERA_HOST ? `http://${process.env.HERA_HOST}` : 'http://localhost:4000'
    )
  })
]

// Ensure that the compiler exits on errors during testing so that
// they do not get skipped and misreported.
if (__TEST__ && !argv.watch) {
  webpackConfig.plugins.push(function () {
    this.plugin('done', function (stats) {
      const errors = []
      if (stats.compilation.errors.length) {
        // Log each of the warnings
        stats.compilation.errors.forEach(function (error) {
          errors.push(error.message || error)
        })

        // Pretend no assets were generated. This prevents the tests
        // from running making it clear that there were warnings.
        throw new Error(errors)
      }
    })
  })
}
github gazab / togglol / config / index.js View on Github external
************************************************/

// ------------------------------------
// Environment
// ------------------------------------
// N.B.: globals added here must _also_ be added to .eslintrc
config.globals = {
  'process.env'  : {
    'NODE_ENV' : JSON.stringify(config.env)
  },
  'NODE_ENV'     : config.env,
  '__DEV__'      : config.env === 'development',
  '__PROD__'     : config.env === 'production',
  '__TEST__'     : config.env === 'test',
  '__DEBUG__'    : config.env === 'development' && !argv.no_debug,
  '__COVERAGE__' : !argv.watch && config.env === 'test',
  '__BASENAME__' : JSON.stringify(process.env.BASENAME || '')
}

// ------------------------------------
// Validate Vendor Dependencies
// ------------------------------------
const pkg = require('../package.json')

config.compiler_vendor = config.compiler_vendor
  .filter((dep) => {
    if (pkg.dependencies[dep]) return true

    debug(
      `Package "${dep}" was not found as an npm dependency in package.json; ` +
      `it won't be included in the webpack vendor bundle.
       Consider removing it from vendor_dependencies in ~/config/index.js`
github google / ioweb2015 / gulpfile.js View on Github external
var generateServiceWorker = require('./gulp_scripts/service-worker');
var backend = require('./gulp_scripts/backend');

var argv = require('yargs').argv;
var IOWA = require('./package.json').iowa;
var DIST_EXPERIMENT_DIR = path.join(IOWA.appDir, IOWA.experimentDir);

// reload is a noop unless '--reload' cmd line arg is specified.
// reload has no effect without '--watch'.
var reload = function() {
  return new require('stream').PassThrough({objectMode: true});
};
if (argv.reload) {
  reload = browserSync.reload;
  // reload doesn't make sense w/o watch
  argv.watch = true;
}

// openUrl is a noop unless '--open' cmd line arg is specified.
var openUrl = function() {};
if (argv.open) {
  openUrl = opn;
}

// Scripts required for the data-fetching worker.
var dataWorkerScripts = [
  IOWA.appDir + '/bower_components/es6-promise/dist/es6-promise.min.js',
  IOWA.appDir + '/scripts/helper/request.js',
  IOWA.appDir + '/scripts/helper/schedule.js',
  IOWA.appDir + '/data-worker.js'
];
github esfx / esfx / gulpfile.js View on Github external
const test = () => {
    const args = new ArgsBuilder();
    args.addSwitch("--testNamePattern", argv.testNamePattern || argv.tests || argv.test || argv.T || argv.t);
    args.addSwitch("--testPathPattern", argv.testPathPattern || argv.files || argv.file || argv.F);
    args.addSwitch("--testPathIgnorePatterns", argv.testPathIgnorePatterns || argv.ignore || argv.I);
    args.addSwitch("--maxWorkers", argv.maxWorkers || argv.w);
    args.addSwitch("--onlyChanged", Boolean(argv.onlyChanged || argv.changed || argv.o || false), false);
    args.addSwitch("--onlyFailures", Boolean(argv.onlyFailures || argv.failed || argv.f || false), false);
    args.addSwitch("--runInBand", Boolean(argv.runInBand || argv.i || false), false);
    args.addSwitch("--watch", Boolean(argv.watch || false), false);
    args.addSwitch("--watchAll", Boolean(argv.watchAll || false), false);
    return exec(process.execPath, [require.resolve("jest/bin/jest"), ...args], { verbose: true });
};
gulp.task("test", gulp.series(build, test));
github FlowCI / flow-web / build / karma.config.js View on Github external
const argv = require('yargs').argv
const webpackConfig = require('./webpack.config')

const TEST_BUNDLER = './tests/test-bundler.js'

const karmaConfig = {
  basePath: '../',
  browsers: !argv.watch ? ['PhantomJS'] : ['Chrome'],
  singleRun: !argv.watch,
  coverageReporter: {
    reporters: [
      { type: 'text-summary' },
    ],
  },
  files: [{
    pattern  : TEST_BUNDLER,
    watched  : false,
    served   : true,
    included : true
  }],
  frameworks: ['mocha'],
  reporters: ['spec'],
  preprocessors: {
    [TEST_BUNDLER]: ['webpack'],
  },
github henrybv / sf-restaurants-react / karma.conf.js View on Github external
plugins: [
      'karma-mocha',
      'karma-chai',
      'karma-webpack',
      'karma-phantomjs-launcher',
      'karma-spec-reporter',
      'karma-sourcemap-loader'
    ],

    reporters: ['spec'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    browsers: ['PhantomJS'],
    singleRun: !argv.watch
  })
};