Socket
Socket
Sign inDemoInstall

jest-haste-map

Package Overview
Dependencies
135
Maintainers
6
Versions
270
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-haste-map


Version published
Weekly downloads
32M
decreased by-1.68%
Maintainers
6
Install size
4.79 MB
Created
Weekly downloads
 

Package description

What is jest-haste-map?

The jest-haste-map npm package is a utility for building a Haste map, which is a mapping from module names to file paths. It is used by Jest to quickly resolve module dependencies for tests by keeping an in-memory map of all available modules. It can handle duplicate module names and provides a way to query the map for a specific module.

What are jest-haste-map's main functionalities?

Building a Haste Map

This code sample demonstrates how to create a new HasteMap instance with a configuration object, build the map, and then use it to get the module name for a specific file.

const HasteMap = require('jest-haste-map');
const config = {
  // These options are required:
  roots: ['/path/to/project'],
  extensions: ['js', 'json'],
  platforms: ['ios', 'android'],
  // You can provide additional options:
  computeSha1: true,
  // other options...
};
const hasteMap = new HasteMap(config);
hasteMap.build().then(map => {
  console.log(map.hasteFS.getModuleName('/path/to/project/file.js'));
});

Querying the Haste Map

This code sample shows how to query the built Haste map for the path of a module given its name, platform, and whether it supports the native platform.

hasteMap.build().then(map => {
  const modulePath = map.moduleMap.getModule('moduleName', 'platform', 'supportsNativePlatform');
  console.log(modulePath);
});

Other packages similar to jest-haste-map

Changelog

Source

23.5.0

Features

  • [jest-cli] Add package name to NotifyReporter notification (#5898)
  • [jest-runner] print stack trace when process.exit is called from user code (#6714)
  • [jest-each] introduces %# option to add index of the test to its title (#6414)
  • [pretty-format] Support serializing DocumentFragment (#6705)
  • [jest-validate] Add recursive and recursiveBlacklist options for deep config checks (#6802)
  • [jest-cli] Check watch plugins for key conflicts (#6697)

Fixes

  • [jest-snapshot] Mark snapshots as obsolete when moved to an inline snapshot (#6773)
  • [jest-config] Fix --coverage with --findRelatedTests overwriting collectCoverageFrom options (#6736)
  • [jest-config] Update default config for testURL from 'about:blank' to 'http://localhost' to address latest JSDOM security warning. (#6792)
  • [jest-cli] Fix testMatch not working with negations (#6648)
  • [jest-cli] Don't report promises as open handles (#6716)
  • [jest-each] Add timeout support to parameterised tests (#6660)
  • [jest-cli] Improve the message when running coverage while there are no files matching global threshold (#6334)
  • [jest-snapshot] Correctly merge property matchers with the rest of the snapshot in toMatchSnapshot. (#6528)
  • [jest-snapshot] Add error messages for invalid property matchers. (#6528)
  • [jest-cli] Show open handles from inside test files as well (#6263)
  • [jest-haste-map] Fix a problem where creating folders ending with .js could cause a crash (#6818)

Chore & Maintenance

  • [docs] Document another option to avoid warnings with React 16 (#5258)
  • [docs] Add note explaining when jest.setTimeout should be called (#6817)
  • [docs] Fixed bug in example code (#6828)

FAQs

Last updated on 10 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc