(workspaceRoot: string, moduleName: string, nodePath: string, tracer: (message: string, verbose?: string) => void)
| 265 | } |
| 266 | |
| 267 | export function resolveModulePath(workspaceRoot: string, moduleName: string, nodePath: string, tracer: (message: string, verbose?: string) => void): Thenable<string> { |
| 268 | if (nodePath) { |
| 269 | if (!path.isAbsolute(nodePath)) { |
| 270 | nodePath = path.join(workspaceRoot, nodePath); |
| 271 | } |
| 272 | |
| 273 | return resolve(moduleName, nodePath, nodePath, tracer).then((value) => { |
| 274 | if (FileSystem.isParent(nodePath, value)) { |
| 275 | return value; |
| 276 | } else { |
| 277 | return Promise.reject<string>(new Error(`Failed to load ${moduleName} from node path location.`)); |
| 278 | } |
| 279 | }).then<string, string>(undefined, (_error: any) => { |
| 280 | return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); |
| 281 | }); |
| 282 | } else { |
| 283 | return resolve(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer); |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Resolves the given module relative to the given workspace root. In contrast to |
no test coverage detected