(hasteMap: InternalHasteMap)
| 761 | } |
| 762 | |
| 763 | private async _crawl(hasteMap: InternalHasteMap) { |
| 764 | const options = this._options; |
| 765 | const ignore = this._ignore.bind(this); |
| 766 | const crawl = (await this._shouldUseWatchman()) ? watchmanCrawl : nodeCrawl; |
| 767 | const crawlerOptions: CrawlerOptions = { |
| 768 | computeSha1: options.computeSha1, |
| 769 | data: hasteMap, |
| 770 | enableSymlinks: options.enableSymlinks, |
| 771 | extensions: options.extensions, |
| 772 | forceNodeFilesystemAPI: options.forceNodeFilesystemAPI, |
| 773 | ignore, |
| 774 | rootDir: options.rootDir, |
| 775 | roots: options.roots, |
| 776 | }; |
| 777 | |
| 778 | const retry = (retryError: Error) => { |
| 779 | if (crawl === watchmanCrawl) { |
| 780 | this._console.warn( |
| 781 | 'jest-haste-map: Watchman crawl failed. Retrying once with node ' + |
| 782 | 'crawler.\n' + |
| 783 | " Usually this happens when watchman isn't running. Create an " + |
| 784 | "empty `.watchmanconfig` file in your project's root folder or " + |
| 785 | 'initialize a git or hg repository in your project.\n' + |
| 786 | ` ${retryError}`, |
| 787 | ); |
| 788 | return nodeCrawl(crawlerOptions).catch(error => { |
| 789 | throw new Error( |
| 790 | 'Crawler retry failed:\n' + |
| 791 | ` Original error: ${retryError.message}\n` + |
| 792 | ` Retry error: ${error.message}\n`, |
| 793 | ); |
| 794 | }); |
| 795 | } |
| 796 | |
| 797 | throw retryError; |
| 798 | }; |
| 799 | |
| 800 | try { |
| 801 | return await crawl(crawlerOptions); |
| 802 | } catch (error: any) { |
| 803 | return retry(error); |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | /** |
| 808 | * Watch mode |
no test coverage detected