Create-react-native-app: Duplicate manual mock found

Created on 27 Jul 2017  Â·  3Comments  Â·  Source: expo/create-react-native-app

Description

When I run npm test from a stock setup of v1.0.0, I get an error about jest-haste-map duplicate manual mock found.

Expected Behavior

I expected npm test to run without any issues.

Observed Behavior

An uncaught error was thrown during the test.

➜  SampleReactNative npm test

> [email protected] test /Users/andy/Code/src/github.com/enozero/SampleReactNative
> node node_modules/jest/bin/jest.js --watch

jest-haste-map: duplicate manual mock found:
  Module name: ErrorUtils
  Duplicate Mock path: /Users/andy/Code/src/github.com/enozero/SampleReactNative/node_modules/react-native/node_modules/fbjs/lib/__mocks__/ErrorUtils.js
This warning is caused by two manual mock files with the same file name.
Jest will use the mock file found in:
/Users/andy/Code/src/github.com/enozero/SampleReactNative/node_modules/react-native/node_modules/fbjs/lib/__mocks__/ErrorUtils.js
 Please delete one of the following two files:
 /Users/andy/Code/src/github.com/enozero/SampleReactNative/node_modules/react-native/Libraries/Core/__mocks__/ErrorUtils.js
/Users/andy/Code/src/github.com/enozero/SampleReactNative/node_modules/react-native/node_modules/fbjs/lib/__mocks__/ErrorUtils.js


2017-07-26 22:54 node[34328] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-07-26 22:54 node[34328] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1018:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1420:11)
npm ERR! Test failed.  See above for more details.

Environment

npm ERR! peer dep missing: react@>=15.3.1, required by [email protected]
npm ERR! peer dep missing: react@>=15.4.0, required by [email protected].

  • node -v: v6.11.1
  • npm -v: 3.10.10
  • yarn --version: command not found: yarn
  • watchman version: command not found: watchman

Also specify:

  1. Operating system: macOS Sierra 10.12.5
  2. Phone/emulator/simulator & version: N/A

Most helpful comment

@SuhairZain see facebook/jest#2070

All 3 comments

hello! the warning that you're seeing is a red herring -- the actual error comes later:

2017-07-26 22:54 node[34328] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2017-07-26 22:54 node[34328] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE

a good way to get around this error is to install watchman. see: https://github.com/facebook/react-native/issues/10028. also, read more about the error here if you're curious

also, i published jest-expo 19.0.2 which resolves the warning (it was harmless but annoying)

cc @fson - maybe we should watch for this error and provide a more useful message.

@brentvatne I have just the same warning, but without any errors. The tests are also running fine. Could this be another issue?

yarn test v0.27.5
$ jest
jest-haste-map: duplicate manual mock found:
  Module name: ErrorUtils
  Duplicate Mock path: /Users/suhairzain/Documents/xx/app/node_modules/react-native/node_modules/fbjs/lib/__mocks__/ErrorUtils.js
This warning is caused by two manual mock files with the same file name.
Jest will use the mock file found in:
/Users/suhairzain/Documents/xx/app/node_modules/react-native/node_modules/fbjs/lib/__mocks__/ErrorUtils.js
 Please delete one of the following two files:
 /Users/suhairzain/Documents/xx/app/node_modules/react-native/Libraries/Core/__mocks__/ErrorUtils.js
/Users/suhairzain/Documents/xx/app/node_modules/react-native/node_modules/fbjs/lib/__mocks__/ErrorUtils.js


(...PASS message for 13 tests)

Test Suites: 13 passed, 13 total
Tests:       29 passed, 29 total
Snapshots:   0 total
Time:        4.617s
Ran all test suites.
Done in 5.93s.

@SuhairZain see facebook/jest#2070

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Palisand picture Palisand  Â·  5Comments

FezVrasta picture FezVrasta  Â·  3Comments

anp picture anp  Â·  3Comments

scf4 picture scf4  Â·  5Comments

Jawadgee picture Jawadgee  Â·  3Comments