title: Jest js node_modules\jest\node_modules\jest-cli\build\cli\index.js:227 } catch {
body: <p>I run <code>npm init</code> <code>npm i -D jest</code> like in this <a href="https://www.youtube.com/watch?v=7r4xVDI2vho&amp;t=621s" rel="noreferrer">tutorial</a></p>
  <p>I am getting this error after running commend <code>nmp test</code></p>
  <p>This is not an error from creatures.js or creatures.test.js because without this file error happening. How can I fix this ? I tried already reinstating mode_modules. I don't know it have a matter but I'm using node 8.17.0 because I'm working with Firebase cloud functions</p>
  <pre><code>PS C:\Users\Pawel\Desktop\HerosIIIJS&gt; npm test
  
  &gt; heros_iii_js@1.0.0 test C:\Users\Pawel\Desktop\HerosIIIJS
  &gt; jest
  
  C:\Users\Pawel\Desktop\HerosIIIJS\node_modules\jest\node_modules\jest-cli\build\cli\index.js:227
      } catch {
              ^
  
  SyntaxError: Unexpected token {
  at createScript (vm.js:80:10)
      at Object.runInThisContext (vm.js:139:10)
      at Module._compile (module.js:617:28)
      at Object.Module._extensions..js (module.js:664:10)
      at Module.load (module.js:566:32)
      at tryModuleLoad (module.js:506:12)
      at Function.Module._load (module.js:498:3)
      at Module.require (module.js:597:17)
      at require (internal/module.js:11:18)
      at Object.&lt;anonymous&gt; (C:\Users\Pawel\Desktop\HerosIIIJS\node_modules\jest\node_modules\jest-cli\bin\jest.js:16:3)
  npm ERR! Test failed.  See above for more details.
  </code></pre>
  <pre><code>const getProjectListFromCLIArgs = (argv, project) =&gt; {
    const projects = argv.projects ? argv.projects : [];
  
    if (project) {
      projects.push(project);
    }
  
    if (!projects.length &amp;&amp; process.platform === 'win32') {
      try {
        projects.push((0, _jestUtil().tryRealpath)(process.cwd()));
      } catch { // &lt;= error
        // do nothing, just catch error
        // process.binding('fs').realpath can throw, e.g. on mapped drives
      }
    }
  
    if (!projects.length) {
      projects.push(process.cwd());
    }
  
    return projects;
  };
  </code></pre>
  <p>package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;heros_iii_js&quot;,
    &quot;version&quot;: &quot;1.0.0&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;scripts&quot;: {
      &quot;test&quot;: &quot;jest&quot;
    },
    &quot;author&quot;: &quot;&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;devDependencies&quot;: {
      &quot;jest&quot;: &quot;^26.6.2&quot;
    }
  }
  
  </code></pre>
  <p>file structure:</p>
  <p><a href="https://i.stack.imgur.com/1JehM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1JehM.png" alt="![enter image description here" /></a></p>