Skip to content

Only ignore root /node_modules/ #1995

@julien-f

Description

@julien-f

Do you want to request a feature or report a bug? feature (or help to configure ;) )

What is the current behavior?

All node_modules/ directories are ignored.

What is the expected behavior?

I would like to ignore only the root node_modules/ directory.

My project organization:

src/
├── node_modules
│   └── local packages (imported via absolute paths)
└── code (imported via relative paths)

The ideas is to build generic-ish modules in src/node_modules.

If a local packages become useful on its own I can publish it in its own package without having to change my code.

It is IMHO the best solution to achieve this kind of behavior by exploiting the locality rule of modules resolution, without having to use a hack like NODE_PATH (which is discouraged).

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

node version = 6.9.1
npm version = 3.10.8
operating system = Debian Stretch
jest version = 16.0.2
test framework = jasmine2
config = {
  "rootDir": "/my-project",
  "name": "-my-project",
  "setupFiles": [
    "/my-project/node_modules/babel-polyfill/lib/index.js"
  ],
  "testRunner": "/my-project/node_modules/jest-jasmine2/build/index.js",
  "scriptPreprocessor": "/my-project/node_modules/babel-jest/build/index.js",
  "usesBabelJest": true,
  "automock": false,
  "bail": false,
  "browser": false,
  "cacheDirectory": "/tmp/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,
  "testEnvironment": "jest-environment-jsdom",
  "testPathDirs": [
    "/my-project"
  ],
  "testPathIgnorePatterns": [
    "/node_modules/"
  ],
  "testRegex": "(/__tests__/.*|\\.(test|spec))\\.jsx?$",
  "testURL": "about:blank",
  "timers": "real",
  "useStderr": false,
  "verbose": null,
  "watch": false,
  "cache": true,
  "watchman": true,
  "testcheckOptions": {
    "times": 100,
    "maxSize": 200
  }
}
No tests found
  21 files checked.
  testPathDirs: /my-project - 21 matches
  testRegex: (/__tests__/.*|\.(test|spec))\.jsx?$ - 0 matches
  testPathIgnorePatterns: /node_modules/ - 21 matches

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