Skip to content

Does not work with requireindex #2017

@xjamundx

Description

@xjamundx

Do you want to request a feature or report a bug?

BUG

What is the current behavior?

requireindex does not work with jest

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal repository on GitHub that we can npm install and npm test.

// my.test.js
var requireindex = require('requireindex')
var x = requireindex('./jest')
var len = Object.keys(x).length
var assert = require('assert')
assert.equal(len, 1)
// jest/one.js
module.exports = {}
node my.test.js # no errors
./node_modules/.bin/jest my.test.js # failure

What is the expected behavior?

requireindex should work

Run Jest again with --debug and provide the full configuration it prints. Please mention your node and npm version and operating system.

~/dev/paypal/p2pnodeweb (pr/jest-all-the-things-2) $ ./node_modules/.bin/jest --no-cache --debug --env node my.test.js 
jest version = 16.0.2
test framework = jasmine2
config = {
  "rootDir": "/Users/jamuferguson/dev/paypal/p2pnodeweb",
  "name": "-Users-jamuferguson-dev-paypal-p2pnodeweb",
  "setupFiles": [
    "/Users/jamuferguson/dev/paypal/p2pnodeweb/node_modules/babel-polyfill/lib/index.js"
  ],
  "testRunner": "/Users/jamuferguson/dev/paypal/p2pnodeweb/node_modules/jest-jasmine2/build/index.js",
  "testEnvironment": "/Users/jamuferguson/dev/paypal/p2pnodeweb/node_modules/jest-environment-node/build/index.js",
  "scriptPreprocessor": "/Users/jamuferguson/dev/paypal/p2pnodeweb/node_modules/babel-jest/build/index.js",
  "usesBabelJest": true,
  "automock": false,
  "bail": false,
  "browser": false,
  "cacheDirectory": "/var/folders/9d/p3qfw0g94yz7qh3z9dr4btwm391xgk/T/jest",
  "clearMocks": false,
  "coveragePathIgnorePatterns": [
    "/node_modules/"
  ],
  "coverageReporters": [
    "json",
    "text",
    "lcov",
    "clover"
  ],
  "globals": {},
  "haste": {
    "providesModuleNodeModules": []
  },
  "mocksPattern": "__mocks__",
  "moduleDirectories": [
    "node_modules"
  ],
  "moduleFileExtensions": [
    "js",
    "json",
    "jsx",
    "node"
  ],
  "moduleNameMapper": {},
  "modulePathIgnorePatterns": [],
  "noStackTrace": false,
  "notify": false,
  "preset": null,
  "preprocessorIgnorePatterns": [
    "/node_modules/"
  ],
  "resetModules": false,
  "testPathDirs": [
    "/Users/jamuferguson/dev/paypal/p2pnodeweb"
  ],
  "testPathIgnorePatterns": [
    "/node_modules/"
  ],
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
  "testURL": "about:blank",
  "timers": "real",
  "useStderr": false,
  "verbose": null,
  "watch": false,
  "cache": false,
  "watchman": true,
  "testcheckOptions": {
    "times": 100,
    "maxSize": 200
  }
}
jest-haste-map: duplicate manual mock found:
  Module name: node-uuid
  Duplicate Mock path: /Users/jamuferguson/dev/paypal/p2pnodeweb/public/js/__mocks__/node-uuid.js
This warning is caused by two manual mock files with the same file name.
Jest will use the mock file found in: 
/Users/jamuferguson/dev/paypal/p2pnodeweb/public/js/__mocks__/node-uuid.js
 Please delete one of the following two files: 
 /Users/jamuferguson/dev/paypal/p2pnodeweb/tests/unit/__mocks__/node-uuid.js
/Users/jamuferguson/dev/paypal/p2pnodeweb/public/js/__mocks__/node-uuid.js


 FAIL  ./my.test.js
  ● Test suite failed to run

    AssertionError: 0 == 1

      at Object.<anonymous> (my.test.js:5:8)
      at process._tickCallback (node.js:369:9)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.84s
Ran all test suites matching "my.test.js".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions