You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

jest-resolve

Package Overview
Dependencies
Maintainers
3
Versions
273
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-resolve


Version published
Weekly downloads
22M
decreased by-19.67%
Maintainers
3
Install size
4.80 MB
Created
Weekly downloads
 

Package description

What is jest-resolve?

The jest-resolve package is a module resolver used by Jest, the JavaScript testing framework. It resolves the location of modules in your project, allowing Jest to hook into the module resolution logic. This is particularly useful for mocking modules or creating custom resolution logic for tests.

What are jest-resolve's main functionalities?

Resolving modules

This feature allows you to resolve the path to a module within your project. You can specify directories and file extensions to consider during resolution.

const Resolver = require('jest-resolve');
const resolver = new Resolver({}, {
  moduleDirectory: ['node_modules'],
  extensions: ['.js', '.json', '.jsx', '.ts', '.tsx', '.node']
});
const resolvedPath = resolver.resolveModule('/path/to/project', 'module-name');

Creating a custom resolver

This feature enables you to create a custom resolver function that can be used by Jest to resolve modules according to your specific needs.

const Resolver = require('jest-resolve');
const customResolver = (request, options) => {
  // Custom resolution logic here
  return Resolver.findNodeModule(request, options);
};

Other packages similar to jest-resolve

FAQs

Package last updated on 20 Feb 2024

Did you know?

Socket

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
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc