title: jest - Pass JSON files as arguments to jest script
body: <p>My code is expected to be run as</p>
  <pre><code>node index.js conf/config1.json conf/config2.json
  </code></pre>
  <p>I am writing tests to validate</p>
  <pre><code>conf/config1.json` and `conf/config2.json
  </code></pre>
  <p>I was hoping to do something like</p>
  <pre><code>npm test -- conf/config1.json conf/config2.json
  </code></pre>
  <p>Where in <code>package.json</code>, <code>scripts.test</code> points to <code>jest</code>.</p>
  <p>This does not work; it fails with this error:</p>
  <pre><code>testRegex:  - 0 matches
  </code></pre>
  <p>In other words, with the above command, <code>jest</code> looks for test files in the <code>conf</code> folder.</p>
  <p><strong><code>test/args.test.js</code></strong>:</p>
  <pre class="lang-js prettyprint-override"><code>const { describe, test, expect, toBe } = require('@jest/globals')
  
  describe('Configuration checks', () =&gt; {
  
    describe('CLI arguments check', () =&gt; {
      test('CLI arguments are exactly two in number', () =&gt; {
      // Write expect code here
      })
  
      test('Configuration file parameter is an existing file', () =&gt; {
        // Write expect code here
      })
  
      test('Configuration file parameter allows reading', () =&gt; {
        // Write expect code here
      })
    })
  })
  </code></pre>