{"id":21173912,"url":"https://github.com/simple-automation-testing/process-rerun","last_synced_at":"2025-06-18T08:36:46.970Z","repository":{"id":57330880,"uuid":"143511545","full_name":"Simple-Automation-Testing/process-rerun","owner":"Simple-Automation-Testing","description":"Run your processes in parallel mode with possibility to re-run them on fail","archived":false,"fork":false,"pushed_at":"2025-04-22T13:16:14.000Z","size":168,"stargazers_count":14,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-22T13:31:59.218Z","etag":null,"topics":["flaky-proceses","flaky-tests","parallel-execution","parallel-processing","processing","ret","retry"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Simple-Automation-Testing.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-08-04T08:27:44.000Z","updated_at":"2025-04-22T13:16:19.000Z","dependencies_parsed_at":"2023-01-21T21:02:53.166Z","dependency_job_id":"8c66e9cc-13fb-4c72-94a9-24f2e46391d9","html_url":"https://github.com/Simple-Automation-Testing/process-rerun","commit_stats":null,"previous_names":["potapovdim/protractor-rerun"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Simple-Automation-Testing/process-rerun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simple-Automation-Testing%2Fprocess-rerun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simple-Automation-Testing%2Fprocess-rerun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simple-Automation-Testing%2Fprocess-rerun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simple-Automation-Testing%2Fprocess-rerun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Simple-Automation-Testing","download_url":"https://codeload.github.com/Simple-Automation-Testing/process-rerun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Simple-Automation-Testing%2Fprocess-rerun/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260520537,"owners_count":23021639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flaky-proceses","flaky-tests","parallel-execution","parallel-processing","processing","ret","retry"],"created_at":"2024-11-20T16:52:39.210Z","updated_at":"2025-06-18T08:36:41.939Z","avatar_url":"https://github.com/Simple-Automation-Testing.png","language":"TypeScript","readme":"# process-rerun\n\nThe purpose of this library is - build simple and flexible interface for parallel command execution with rerun (on fail) possibility\n\n![npm downloads](https://img.shields.io/npm/dm/process-rerun.svg?style=flat-square)\n\n[Documents](#documents)\u003cbr\u003e\n[Usage](#usage)\u003cbr\u003e\n[getFilesList](#getfileslist)\u003cbr\u003e\u003cbr\u003e\n[Changelog](#changelog)\n\n## Documents\n\n**buildRunner(buildOpts): returns rerunner: function(string[]): {retriable: string[]; notRetriable: string[]}**\n\narguments | description\n--- | ---\n**`buildOpts`** | Type: `object` \u003cbr\u003e Options for executor\n**`buildOpts.maxThreads`** | **Optional** Type: `number`, \u003cbr\u003e How many threads can be executed in same time \u003cbr\u003e **Default threads count is 5**\n**`buildOpts.intime`** | **Optional** Type: `boolean`, \u003cbr\u003e if intime is true intime execution approach will be enabled\u003cbr\u003e **Default  is false**\n**`buildOpts.shuffle`** | **Optional** Type: `boolean`, \u003cbr\u003e Shuffle commands during execution \u003cbr\u003e **Default threads count is 5**\n**`buildOpts.attemptsCount`** | **Optional** Type: `number`, \u003cbr\u003e 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** \u003cbr\u003e **Default attempts count is 2**\n**`buildOpts.pollTime`** | **Optional** Type: `number`, \u003cbr\u003e Period for recheck about free thread \u003cbr\u003e **Default is 1 second**\n**`buildOpts.successExitCode`** | **Optional** Type: `number`, \u003cbr\u003e Exit code what will be used for succes process check \u003cbr\u003e **Default is 0**\n**`buildOpts.logLevel`** | Type: `string`, one of 'ERROR', 'WARN', 'INFO', 'VERBOSE', 'MUTE' \u003cbr\u003e ERROR - only errors, WARN -  errors and warnings, INFO - errors, warnings and information, VERBOSE - full logging, MUTE - mute execution output \u003cbr\u003e **Default is 'ERROR'**\n**`buildOpts.currentExecutionVariable`** | **Optional** Type: `string`, will be execution variable with execution index for every cycle will be ++\u003cbr\u003e\n**`buildOpts.everyCycleCallback`** | **Optional** Type: `function`, \u003cbr\u003e Optional. everyCycleCallback will be executed after cycle, before next execution cycle.\u003cbr\u003e **Default is false**\n**`buildOpts.processResultAnalyzer`** | **Optional** Type: `function`, \u003cbr\u003e 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 **boolean** - if satisfactory result \u003cbr\u003e\n**`buildOpts.longestProcessTime`** | **Optional** Type: `number`, \u003cbr\u003e 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. \u003cbr\u003e **Default time is 45 seconds**\n\n## Usage\n\n```js\nconst {buildRunner} = require('process-rerun');\n\nasync function execCommands() {\n  const runner = buildRunner({\n    maxThreads: 10,               // ten threads\n    attemptsCount: 2,             // will try to pass all commands two times, one main and one times rerun\n    longestProcessTime: 60 * 1000,// if command process execution time is longre than 1 minute will kill it and try to pass in next cycle\n    pollTime: 1000,               // will check free thread every second\n    everyCycleCallback: () =\u003e console.log('Cycle done'),\n    processResultAnalyzer: (cmd, stackTrace, notRetriableArr) =\u003e {\n      if (stackTrace.includes('Should be re executed')) {\n        return cmd;\n      }\n      notRetriableArr.push(cmd)\n    }, //true - command will be reexecuted\n  });\n  const result = await runner([\n    `node -e 'console.log(\"Success first\")'`,\n    `node -e 'console.log(\"Success second\")'`,\n    `node -e 'console.log(\"Failed first\"); process.exit(1)'`,\n    `node -e 'console.log(\"Success third\")'`,\n    `node -e 'console.log(\"Failed second\"); process.exit(1)'`,\n  ])\n\n  console.log(result);\n  /*\n  {\n    retriable: [\n      `node -e 'console.log(\"Failed first\"); process.exit(1)' --opt1=opt1value --opt1=opt1value`,\n      `node -e 'console.log(\"Failed second\"); process.exit(1)' --opt1=opt1value --opt1=opt1value`\n    ],\n    notRetriable: []\n  }\n  */\n}\n```\n\n## getfileslist\n\narguments | description\n--- | ---\n**`dir`** | Type: `string` , *required* \u003cbr\u003e Directory what will be used as a root\n**`fileList`** | Type: `Array\u003cstring\u003e` ,  \u003cbr\u003e This array will be used as a target for push new file\n**`directoryToSkip`** | Type: `Array\u003cstring\u003e|string|regex`, \u003cbr\u003e Exlude some directory\n**`ignoreSubDirs`** | Type: `boolean`, \u003cbr\u003e In case of true - sub directories will be ignored\n\n### usage exampele\n\n```js\nconst {getFilesList} = require('process-rerun');\n\nconst readmePath = getFilesList(__dirname).find((filePath) =\u003e filePath.include('readme.md'));\n```\n\n## intime approach vs circle approach\n\n### circle approach\n\nfive processes execution, two execution attempts, five parallel execution \u003cbr\u003e\n\nfirst execution attempt (three failed) | second execution attempt (one failed) | third execution attempt (o failed)\n--- | --- | ----\n1 p1 --------------------------\u003e success | p2 ---\u003e success                       | p4 -----------\u003e success\n2 p2 ---\u003e fail                           | p4 -----------\u003e fail                  |\n3 p3 -------\u003e fail                       | p3 -------\u003e success                   |\n4 p4 -----------\u003e fail                   |                                       |\n5 p5 -----\u003e success                      |                                       |\n\nFull execution time: \u003cbr\u003e\np1 (first attempt) --------------------------\u003e + p4 (second attempt) -----------\u003e + (third attempt) p4 -----------\u003e\n\n### intime approach (with same fail scheme)\n\nevery process has attemp count timer\n\nf - fail \u003cbr\u003e\ns - success \u003cbr\u003e\n1 p1 --------------------------\u003es             \u003cbr\u003e\n2 p2 ---\u003ef---\u003es                               \u003cbr\u003e\n3 p3 -------\u003ef-------\u003es                       \u003cbr\u003e\n4 p4 -----------\u003ef                            \u003cbr\u003e\n5 p5 -----\u003es(p4)-----------\u003ef-----------\u003es    \u003cbr\u003e\n\nFull execution time: \u003cbr\u003e\n\n5 p5 -----\u003es(p4)-----------\u003ef-----------\u003es\n\nFailed process will check that free parallel exists and start execution when free parallel will be found.\n\n## Changelog\n[Version 0.1.11](/docs/verion0.1.11.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimple-automation-testing%2Fprocess-rerun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimple-automation-testing%2Fprocess-rerun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimple-automation-testing%2Fprocess-rerun/lists"}