npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webdriverio-parallel-retrier

v0.0.2

Published

🛠 Development in progress, beta version

Downloads

10

Readme

webdriverio-parallel-retrier

🛠 Development in progress, beta version

npm downloads

This library is a wrapper around process-rerun

The purpose of this library is - build simple and flexible interface for wdio framework parallel execution with rerun (on fail) possibility

Usage and Example

Documentation

usage

const {buildExecutor} = require('webdriverio-parallel-retrier');

executeAsQueue();
async function executeAsQueue() {

  const testCaseRegPattern = /(?<=it\(').+(?=')/ig;
  const cwd = process.cwd();

  const result = await buildExecutor(resolve(cwd, './wdio.conf.js'), resolve(cwd, './built/specs'))
    .asQueue(testCaseRegPattern, ['test case it name 1', 'test case it name 2', 'test case it name 3'])
    .command({'--process-argument': 'process-argument-value'}, {ENV_VARIABLE: 'en-varialbe-value'})
    .executor({attemptsCount: 2, maxThreads: 1, logLevel: 'VERBOSE', longestProcessTime: 60 * 1000, pollTime: 100})
    .execute();

  console.log(result);
  if(result.retriable.length || result.notRetriable.length) {
    process.exit(1);
  }
}

executeOnlyRequiredCases();
async function executeAsQueue() {

  const testCaseRegPattern = /(?<=it\(').+(?=')/ig;
  const cwd = process.cwd();

  const result = await buildExecutor(resolve(cwd, './wdio.conf.js'), resolve(cwd, './built/specs'))
    .asQueue(testCaseRegPattern, ['test case it name 1', 'test case it name 2', 'test case it name 3'])
    .command({'--process-argument': 'process-argument-value'}, {ENV_VARIABLE: 'en-varialbe-value'})
    .executor({attemptsCount: 2, maxThreads: 10, logLevel: 'VERBOSE', longestProcessTime: 60 * 1000, pollTime: 100})
    .execute();

  console.log(result);
  if(result.retriable.length || result.notRetriable.length) {
    process.exit(1);
  }
}

executeByFile();
async function executeByFile() {
  const cwd = process.cwd();
  const result = await buildExecutor(resolve(cwd, './wdio.conf.js'), resolve(cwd, './built/specs'))
    .byFile()
    .command({'--process-argument': 'process-argument-value'}, {ENV_VARIABLE: 'en-varialbe-value'})
    .executor({attemptsCount: 2, maxThreads: 5, logLevel: 'VERBOSE', longestProcessTime: 60 * 1000, pollTime: 100})
    .execute();

  console.log(result);
  if(result.retriable.length || result.notRetriable.length) {
    process.exit(1);
  }
}


executeByIt();
async function executeByIt() {
  const cwd = process.cwd();
  const testCaseRegPattern = /(?<=it\(').+(?=')/ig;
  const result = await buildExecutor(resolve(cwd, './wdio.conf.js'), resolve(cwd, './built/specs'))
    .byIt(testCaseRegPattern)
    .command({'--process-argument': 'process-argument-value'}, {ENV_VARIABLE: 'en-varialbe-value'})
    .executor({attemptsCount: 2, maxThreads: 2, logLevel: 'VERBOSE', longestProcessTime: 60 * 1000, pollTime: 100})
    .execute();

  console.log(result);
  if(result.retriable.length || result.notRetriable.length) {
    process.exit(1);
  }
}

Documentation

buildExecutor

buildExecutor('./path/to/wdio.conf.js', './path/to/specs/folder')

arguments | description --- | --- pathTowdioConfigFile | Type: string Path to wdio config file pathToSpecFolderOrSpecsFilesList | Type: string or string[] Path to specs folder, or list (array) with specs files path;

returns {byIt: function; byFile: function; asQueue: function}

byIt

buildExecutor(...args).byIt(/(?<=it\(').+(?=')/ig) or .byIt()

arguments | description --- | --- itPattern | Type: OPTIONAL RegEx RegEx for it title. example it('test item'); -> itRegEx = /(?<=it(').+(?=')/ig; in case of undefined library will define itPattern based on first symbol in it title; pathToSpecFolderOrSpecsFilesList | Type: string or string[] Path to specs folder, or list (array) with specs files path;

returns {command: function}

byFile

buildExecutor(...args).byFile()

no arguments here

returns {command: function}

asQueue

buildExecutor(...args).asQueue(/(?<=it\(').+(?=')/ig, ['test1', 'test2', 'test 10']) or buildExecutor(...args).asQueue(['test1', 'test2', 'test 10'])

arguments | description --- | --- itPattern | Type: OPTIONAL RegEx RegEx for it title. example it('test item'); -> itRegEx = /(?<=it(').+(?=')/ig; in case of undefined library will define itPattern based on first symbol in it title; casesList | Type: string[] List with tests what should be executed one by on can be first argument, because itPattern is an optional

returns {command: function}

command

buildExecutor(...args).asQueue(...args1).command({'--test': 'test'}, {ENV: 'test'}) or buildExecutor(...args).asQueue(...args1).command()

arguments | description --- | --- processArgs | Type: undefined | null | {[prop: string]: string} Object with required process argumentss, use format prop name with - or --, example '--prop' or '-p' processEnvVars | Type: undefined | null | {[prop: string]: string} Object with required process env variables, use format prop name upper snake_case, LOG_LEVEL

returns {executor: function}

executor

buildExecutor(...args).asQueue(...args1).command().executor({maxThreads: 1, attemptsCount: 2, logLevel: 'ERROR'})

arguments | description --- | --- buildOpts | Type: object Options for executor buildOpts.maxThreads | Type: number, How many threads can be executed in same time Default threads count is 5 buildOpts.attemptsCount | Type: number, How many times can we try to execute command for success result in next cycle will be executed only faild command, success commands will not be reexecuted Default attempts count is 2 buildOpts.pollTime | Type: number , Period for recheck about free thread Default is 1 second buildOpts.logLevel | Type: string, one of 'ERROR', 'WARN', 'INFO', 'VERBOSE', ERROR - only errors, WARN - errors and warnings, INFO - errors, warnings and information, VERBOSE - full logging Default is 'ERROR' buildOpts.currentExecutionVariable | Type: string, will be execution variable with execution index for every cycle will be ++ buildOpts.everyCycleCallback | Type: function, Optional. everyCycleCallback will be executed after cycle, before next execution cycle. Default is false buildOpts.processResultAnalyzer | Type: function, Optional. processResultAnalyzer is a function where arguments are original command, execution stack trace and notRetriable array processResultAnalyzer should return a new command what will be executed in next cycle or null - if satisfactory result buildOpts.longestProcessTime | Type: number, In case if command execution time is longer than longest Process Time - executor will kill it automatically and will try to execute this command again. Default time is 45 seconds

returns {execute: async function}

execute

buildExecutor(...args).asQueue(...args1).command().executor(...args2).execute()

no arguments here

returns {retriable: string[]; notRetriable: string[]}