{"id":1651,"date":"2026-10-26T12:23:58","date_gmt":"2026-10-26T12:23:58","guid":{"rendered":"https:\/\/razvanvancea.ro\/blog\/?p=1651"},"modified":"2026-10-26T12:30:57","modified_gmt":"2026-10-26T12:30:57","slug":"how-to-pass-additional-arguments-to-an-npm-script","status":"publish","type":"post","link":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/","title":{"rendered":"How to Pass Additional Arguments to an npm Script"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"1651\" class=\"elementor elementor-1651\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-82b9423 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"82b9423\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-41498bf\" data-id=\"41498bf\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-536e7f4 elementor-widget elementor-widget-text-editor\" data-id=\"536e7f4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p data-pm-slice=\"1 1 []\">When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your <code dir=\"ltr\">package.json<\/code>.<\/p><p>Luckily, npm provides a simple way to do this using the <code dir=\"ltr\">--<\/code> separator.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-439ad53 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"439ad53\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ab95ba9\" data-id=\"ab95ba9\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8e73824 elementor-widget elementor-widget-heading\" data-id=\"8e73824\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">The Problem<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4a30163 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4a30163\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-78172bc\" data-id=\"78172bc\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f362c55 elementor-widget elementor-widget-text-editor\" data-id=\"f362c55\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p data-pm-slice=\"1 1 []\">Let&#8217;s say you have the following script defined in your <code dir=\"ltr\">package.json<\/code>:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-896db32 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"896db32\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-11b9987\" data-id=\"11b9987\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-221f672 elementor-widget elementor-widget-image\" data-id=\"221f672\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"566\" height=\"222\" src=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2026\/10\/Screenshot-2026-10-26-at-14.25.07.png\" class=\"attachment-large size-large wp-image-1653\" alt=\"npm-flag\" srcset=\"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2026\/10\/Screenshot-2026-10-26-at-14.25.07.png 566w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2026\/10\/Screenshot-2026-10-26-at-14.25.07-300x118.png 300w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2026\/10\/Screenshot-2026-10-26-at-14.25.07-24x9.png 24w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2026\/10\/Screenshot-2026-10-26-at-14.25.07-36x14.png 36w, https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2026\/10\/Screenshot-2026-10-26-at-14.25.07-48x19.png 48w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-18dd462 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"18dd462\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3339ac3\" data-id=\"3339ac3\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-18fd3ff elementor-widget elementor-widget-text-editor\" data-id=\"18fd3ff\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p data-pm-slice=\"1 1 []\">Running <strong><code dir=\"ltr\">npm run test<\/code><\/strong> executes:<\/p><pre><code class=\"language-bash\">npx playwright test<\/code><\/pre><p>But what if you want to run your Playwright tests in <strong>headed mode<\/strong>, so you can actually see the browser while the tests execute?<br \/><br \/>You might try &#8216;<code class=\"language-bash\">npm run test --headed' , however, <\/code>npm doesn&#8217;t reliably forward arguments like <code dir=\"ltr\">--headed<\/code> directly to the underlying script.<\/p><p><code class=\"language-bash\"><\/code><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5d12067 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5d12067\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1ca99bf\" data-id=\"1ca99bf\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-dce4049 elementor-widget elementor-widget-heading\" data-id=\"dce4049\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">The Solution: Use --<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-fe4bf3c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"fe4bf3c\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b9f7dc8\" data-id=\"b9f7dc8\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-61c4c29 elementor-widget elementor-widget-text-editor\" data-id=\"61c4c29\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p data-pm-slice=\"1 1 []\">To pass additional arguments to an npm script, simply add <code dir=\"ltr\">--<\/code> before your arguments:<\/p><pre data-pm-slice=\"1 1 []\"><strong>npm run test -- --headed<\/strong><strong><code class=\"language-bash\"><\/code><\/strong><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-021a765 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"021a765\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f47e612\" data-id=\"f47e612\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d1a42e4 elementor-widget elementor-widget-text-editor\" data-id=\"d1a42e4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p data-pm-slice=\"1 1 []\">The <code dir=\"ltr\">--<\/code> separator tells npm to stop interpreting subsequent arguments and pass them directly to the script being executed.<\/p><p>Effectively, the command becomes:<\/p><pre><code class=\"language-bash\">npx playwright test --headed<\/code><\/pre><p>That&#8217;s it! No changes to your <code dir=\"ltr\">package.json<\/code> are necessary.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7f2984e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7f2984e\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-716a196\" data-id=\"716a196\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-42f2b21 elementor-widget elementor-widget-heading\" data-id=\"42f2b21\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Final thoughts<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-2053107 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2053107\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-191d6bc\" data-id=\"191d6bc\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d47784b elementor-widget elementor-widget-text-editor\" data-id=\"d47784b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p data-pm-slice=\"1 1 []\">The next time you need to customize the behavior of an npm script, remember this simple pattern:<\/p><pre><code class=\"language-bash\">npm run &lt;script-name&gt; -- &lt;additional-arguments&gt;<\/code><\/pre><p>It&#8217;s a small trick, but it makes npm scripts much more flexible and saves you from creating multiple scripts for minor command variations.<\/p><p><strong>One separator, unlimited possibilities.<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d65e7e5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d65e7e5\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4caa9d5\" data-id=\"4caa9d5\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-20d4b50 elementor-widget elementor-widget-spacer\" data-id=\"20d4b50\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a038d1d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a038d1d\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ffaad6a\" data-id=\"ffaad6a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2164cf1 elementor-widget elementor-widget-text-editor\" data-id=\"2164cf1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Enjoyed this article?<br \/>I share more practical automation tips on\u00a0<a href=\"https:\/\/www.youtube.com\/c\/LearnwithRV\/videos\" target=\"_blank\" rel=\"noopener\"><strong>YouTube<\/strong><\/a>\u00a0and\u00a0<a href=\"https:\/\/www.linkedin.com\/in\/razvanvancea\/\" target=\"_blank\" rel=\"noopener\"><strong>LinkedIn<\/strong><\/a>.<\/p><p><strong>Need structured guidance instead of learning alone?<\/strong><br \/>I offer\u00a0<strong>1-on-1 mentoring<\/strong>\u00a0&#8211; learn more \u2192\u00a0<strong><a href=\"https:\/\/razvanvancea.ro\/1on1.html\" target=\"_blank\" rel=\"noopener\">HERE<\/a><\/strong><\/p><p>Or email me at\u00a0<strong>iamqarv [at] gmail [dot] com<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>When working with npm scripts, you might occasionally need to pass additional command-line arguments without&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1],"tags":[],"class_list":["post-1651","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Razvan Vancea\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Learn with RV - Tech Blog - #testautomation #qa #programming #linux #devops\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-10-26T12:23:58+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-10-26T12:30:57+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/razvanvancea\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@RazvanVancea\" \/>\n\t\t<meta name=\"twitter:title\" content=\"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@RazvanVancea\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#blogposting\",\"name\":\"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog\",\"headline\":\"How to Pass Additional Arguments to an npm Script\",\"author\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/Screenshot-2026-10-26-at-14.25.07.png\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#articleImage\",\"width\":566,\"height\":222,\"caption\":\"npm-flag\"},\"datePublished\":\"2026-10-26T12:23:58+00:00\",\"dateModified\":\"2026-10-26T12:30:57+00:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#webpage\"},\"articleSection\":\"Uncategorized\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/uncategorized\\\/#listItem\",\"name\":\"Uncategorized\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/uncategorized\\\/#listItem\",\"position\":2,\"name\":\"Uncategorized\",\"item\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/uncategorized\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#listItem\",\"name\":\"How to Pass Additional Arguments to an npm Script\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#listItem\",\"position\":3,\"name\":\"How to Pass Additional Arguments to an npm Script\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/category\\\/uncategorized\\\/#listItem\",\"name\":\"Uncategorized\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#person\",\"name\":\"RV\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#personImage\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/91ce41471f9ba5f15b3ef99e7deed87c.jpg?ver=1792669253\",\"width\":96,\"height\":96,\"caption\":\"RV\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/razvanvancea\\\/\",\"https:\\\/\\\/twitter.com\\\/RazvanVancea\",\"https:\\\/\\\/www.youtube.com\\\/@LearnwithRV\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/razvanvancea\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/\",\"name\":\"Razvan Vancea\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#authorImage\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/356548feb901191539c03dd4a0498f58.jpg?ver=1792669253\",\"width\":96,\"height\":96,\"caption\":\"Razvan Vancea\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#webpage\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/\",\"name\":\"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog\",\"description\":\"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/2026\\\/10\\\/26\\\/how-to-pass-additional-arguments-to-an-npm-script\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/author\\\/iamrv\\\/#author\"},\"datePublished\":\"2026-10-26T12:23:58+00:00\",\"dateModified\":\"2026-10-26T12:30:57+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/\",\"name\":\"Learn with RV - Tech Blog\",\"description\":\"#testautomation #qa #programming #linux #devops\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/razvanvancea.ro\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog","description":"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to","canonical_url":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#blogposting","name":"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog","headline":"How to Pass Additional Arguments to an npm Script","author":{"@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author"},"publisher":{"@id":"https:\/\/razvanvancea.ro\/blog\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/uploads\/2026\/10\/Screenshot-2026-10-26-at-14.25.07.png","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#articleImage","width":566,"height":222,"caption":"npm-flag"},"datePublished":"2026-10-26T12:23:58+00:00","dateModified":"2026-10-26T12:30:57+00:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#webpage"},"isPartOf":{"@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#webpage"},"articleSection":"Uncategorized"},{"@type":"BreadcrumbList","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/razvanvancea.ro\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/uncategorized\/#listItem","name":"Uncategorized"}},{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/uncategorized\/#listItem","position":2,"name":"Uncategorized","item":"https:\/\/razvanvancea.ro\/blog\/category\/uncategorized\/","nextItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#listItem","name":"How to Pass Additional Arguments to an npm Script"},"previousItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#listItem","position":3,"name":"How to Pass Additional Arguments to an npm Script","previousItem":{"@type":"ListItem","@id":"https:\/\/razvanvancea.ro\/blog\/category\/uncategorized\/#listItem","name":"Uncategorized"}}]},{"@type":"Person","@id":"https:\/\/razvanvancea.ro\/blog\/#person","name":"RV","image":{"@type":"ImageObject","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#personImage","url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/litespeed\/avatar\/91ce41471f9ba5f15b3ef99e7deed87c.jpg?ver=1792669253","width":96,"height":96,"caption":"RV"},"sameAs":["https:\/\/www.facebook.com\/razvanvancea\/","https:\/\/twitter.com\/RazvanVancea","https:\/\/www.youtube.com\/@LearnwithRV","https:\/\/www.linkedin.com\/in\/razvanvancea"]},{"@type":"Person","@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author","url":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/","name":"Razvan Vancea","image":{"@type":"ImageObject","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#authorImage","url":"https:\/\/razvanvancea.ro\/blog\/wp-content\/litespeed\/avatar\/356548feb901191539c03dd4a0498f58.jpg?ver=1792669253","width":96,"height":96,"caption":"Razvan Vancea"}},{"@type":"WebPage","@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#webpage","url":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/","name":"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog","description":"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/razvanvancea.ro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/#breadcrumblist"},"author":{"@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author"},"creator":{"@id":"https:\/\/razvanvancea.ro\/blog\/author\/iamrv\/#author"},"datePublished":"2026-10-26T12:23:58+00:00","dateModified":"2026-10-26T12:30:57+00:00"},{"@type":"WebSite","@id":"https:\/\/razvanvancea.ro\/blog\/#website","url":"https:\/\/razvanvancea.ro\/blog\/","name":"Learn with RV - Tech Blog","description":"#testautomation #qa #programming #linux #devops","inLanguage":"en-US","publisher":{"@id":"https:\/\/razvanvancea.ro\/blog\/#person"}}]},"og:locale":"en_US","og:site_name":"Learn with RV - Tech Blog - #testautomation #qa #programming #linux #devops","og:type":"article","og:title":"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog","og:description":"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to","og:url":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/","article:published_time":"2026-10-26T12:23:58+00:00","article:modified_time":"2026-10-26T12:30:57+00:00","article:publisher":"https:\/\/www.facebook.com\/razvanvancea","twitter:card":"summary_large_image","twitter:site":"@RazvanVancea","twitter:title":"How to Pass Additional Arguments to an npm Script - Learn with RV - Tech Blog","twitter:description":"When working with npm scripts, you might occasionally need to pass additional command-line arguments without modifying your package.json.Luckily, npm provides a simple way to do this using the -- separator. The Problem Let\u2019s say you have the following script defined in your package.json: Running npm run test executes:npx playwright testBut what if you want to","twitter:creator":"@RazvanVancea"},"aioseo_meta_data":{"post_id":"1651","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-10-26 12:23:58","updated":"2026-10-26 12:30:58","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/razvanvancea.ro\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/razvanvancea.ro\/blog\/category\/uncategorized\/\" title=\"Uncategorized\">Uncategorized<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tHow to Pass Additional Arguments to an npm Script\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/razvanvancea.ro\/blog\/"},{"label":"Uncategorized","link":"https:\/\/razvanvancea.ro\/blog\/category\/uncategorized\/"},{"label":"How to Pass Additional Arguments to an npm Script","link":"https:\/\/razvanvancea.ro\/blog\/2026\/10\/26\/how-to-pass-additional-arguments-to-an-npm-script\/"}],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts\/1651","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/comments?post=1651"}],"version-history":[{"count":4,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts\/1651\/revisions"}],"predecessor-version":[{"id":1656,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/posts\/1651\/revisions\/1656"}],"wp:attachment":[{"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/media?parent=1651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/categories?post=1651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/razvanvancea.ro\/blog\/wp-json\/wp\/v2\/tags?post=1651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}