* Gets the nearest npm_modules directory
(options)
| 85 | * Gets the nearest npm_modules directory |
| 86 | */ |
| 87 | function getNearestNodeModulesDirectory (options) { |
| 88 | |
| 89 | // Get the nearest node_modules directories to the current working directory |
| 90 | let nodeModulesDirectories = findNodeModules(options); |
| 91 | |
| 92 | // Make sure we find a node_modules folder |
| 93 | |
| 94 | /* istanbul ignore else */ |
| 95 | if (nodeModulesDirectories && nodeModulesDirectories.length > 0) { |
| 96 | return nodeModulesDirectories[0]; |
| 97 | } else { |
| 98 | console.error(`Error: Could not locate node_modules in your project's root directory. Did you forget to npm init or npm install?`) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Gets the nearest project root directory |
no outgoing calls
no test coverage detected