Skip to content

Instantly share code, notes, and snippets.

@christianscott
Last active August 30, 2021 00:14
Show Gist options
  • Save christianscott/70e7545b96ed4ad357a3dbaf6a3bfdaf to your computer and use it in GitHub Desktop.
Save christianscott/70e7545b96ed4ad357a3dbaf6a3bfdaf to your computer and use it in GitHub Desktop.
HasteMap impl that does not crawl
const { default: HasteMap } = require("jest-haste-map");
class NoCrawlHasteMap extends HasteMap {
// https://github.com/facebook/jest/blob/master/packages/jest-haste-map/src/index.ts#L754-L798
// usually calls out to a fn that runs `find` in the current directory, which is *incredibly*
// slow if you have a lot of files
async _crawl() {
return {
hasteMap: this._createEmptyMap(),
removedFiles: [],
};
}
}
module.exports = NoCrawlHasteMap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment