Skip to content
Learn with RV – Tech Blog
Learn with RV – Tech Blog

#testautomation #qa #programming #linux #devops

  • Home
  • Who am I?
  • 1-on-1 Mentoring
  • 18 Testimonials
  • YouTube
  • LinkedIn
  • Contact
Learn with RV – Tech Blog

#testautomation #qa #programming #linux #devops

repeat-cli-command-logo
March 12, 2025March 12, 2025

How to repeat any CLI Command for X times using NPM repeat-cli-command

In this article I will show you an awesome NPM tool that I created called repeat-cli-command. It is open source and I invite you to contribute to it. This tool allows you to repeat any CLI command effortlessly for an X number of times. 

Whether you are running tests, debugging, or just want to loop a command, this tool has you covered.

Let’s dive in!

Installation

First, install it globally (-g) or at project level (-D) with npm.

npm install -g repeat-cli-command

Usage

Let's say we want to repeat a simple command like printing "Hello" to the terminal, for 5 times. We just run

 

npx repeat-cli-command "echo 'Hello' " --times=5

Now, let’s say you’re working with PactumJS for API testing (or any other testing framework) and want to rerun the tests for 10 times.

npx repeat-cli-command 'npx mocha api_tests --timeout=10000' --times=10

What if you have some web e2e automated tests with TestCafe? No problem!

npx repeat-cli-command 'npx testcafe chrome:headless web_tests' --times=2

Simple, isn’t it?

This is how you can use repeat-cli-command to boost productivity! It works with any CLI command and can become handy for testing, debugging, and much more.

Enjoyed this article? Make sure to subscribe to my YouTube Channel for more Test Automation tutorials, and follow me on LinkedIn and Twitter for regular insights.
Looking to improve your test automation skills?
I’ve created a personalized 1-on-1 Mentoring program refined to boost YOUR CURRENT skills. Reach out at iamrv@razvanvancea.ro for more details and together will create a learning path adapted to your skills and goals that you are aiming for, in a timely-efficient manner🚀

Post Views: 64

Related

Share this article:
Linux Tools

Post navigation

Previous post

Recent Posts

  • How to repeat any CLI Command for X times using NPM repeat-cli-command
  • k9s: A Guide to Master Kubernetes Clusters from your Terminal
  • Test Reporting with Testbeats: A Step-by-Step Guide to Playwright Integration
  • npm rimraf vs rm -rf: Which one should you use?
  • Web Accessibility: A step-by-step guide to Testing with @axe-core/cli

Recent Comments

  1. Paul on Web Accessibility: A step-by-step guide to Testing with pa11y
  2. Automated Tests for website Accessibility with Axe and TestCafe - Learn with RV - Tech Blog on How to generate E2E TestCafe Framework in seconds
  3. RV on Exploring Faker.js: A Powerful Tool for Generating Realistic Random Test Data
  4. Adrian Maciuc on Exploring Faker.js: A Powerful Tool for Generating Realistic Random Test Data
  5. Nick on Cypress vs Playwright vs Testcafe – which framework is faster?

Archives

  • March 2025
  • February 2025
  • January 2025
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023

Categories

  • Linux
  • Programming
  • QA
  • Tools
  • Uncategorized
©2025 Learn with RV – Tech Blog | WordPress Theme by SuperbThemes