title: React Native + Jest EMFILE: too many open files error
body: <p>I am trying to run Jest tests, but I'm getting the following error:</p>
  
  <blockquote>
    <p>Error reading file: <code>/Users/mike/dev/react/TestTest/node_modules/react-native/node_modules/yeoman-environment/node_modules/globby/node_modules/glob/node_modules/path-is-absolute/package.json</code>
    /Users/mike/dev/react/TestTest/node_modules/jest-cli/node_modules/node-haste/lib/loader/ResourceLoader.js:88
          throw err;
          ^</p>
    
    <p>Error: EMFILE: too many open files, open '/Users/mike/dev/react/TestTest/node_modules/react-native/node_modules/yeoman-environment/node_modules/globby/node_modules/glob/node_modules/path-is-absolute/package.json'
        at Error (native)
    npm ERR! Test failed.  See above for more details.</p>
  </blockquote>
  
  <p>What is interesting to me is that the path listed in the error points to a file in the node_modules directory, which I expected would not be read because of the node_modules entry in testPathIgnorePatterns. </p>
  
  <p>I'm running Node 4.2.1, my install of React-Native is only a week old, I installed Jest today (so I think I'm up to date with everything).  I'm on a Mac.</p>
  
  <p>I have run: <code>sudo ulimit -n 10240</code>, closed all Terminal windows, and even tried a reboot.  (In my .bash_profile I had previously added <code>ulimit -n 1024</code>.  And I've tried even larger numbers. </p>
  
  <p>To make sure the problem is not just in my own project, I created a new project with <code>react-native init TestTest</code> and made RN's suggested changes to the package.json:</p>
  
  <pre><code>{
    "name": "TestTest",
    "version": "0.0.1",
    "private": true,
    "scripts": {
      "start": "node_modules/react-native/packager/packager.sh",
      "test": "jest"
    },
    "dependencies": {
      "react-native": "^0.14.1"
    },
    "jest": {
      "scriptPreprocessor": "node_modules/react-native/jestSupport/scriptPreprocess.js",
      "setupEnvScriptFile": "node_modules/react-native/jestSupport/env.js",
      "testPathIgnorePatterns": [
        "/node_modules/",
        "packager/react-packager/src/Activity/"
      ],
      "testFileExtensions": [
        "js"
      ],
      "unmockedModulePathPatterns": [
        "promise",
        "source-map"
      ]
    },
    "devDependencies": {
      "jest-cli": "^0.7.1"
    }
  }
  </code></pre>
  
  <p>But I'm getting the same error every time.  </p>