Socket
Socket
Sign inDemoInstall

jest-resolve

Package Overview
Dependencies
59
Maintainers
6
Versions
271
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-resolve


Version published
Weekly downloads
27M
increased by2.58%
Maintainers
6
Install size
5.16 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

Last updated on 13 Jul 2022

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