Socket
Socket
Sign inDemoInstall

jest-resolve

Package Overview
Dependencies
54
Maintainers
3
Versions
272
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jest-resolve


Version published
Maintainers
3
Install size
5.39 MB
Created

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

Changelog

Source

29.7.0

Features

  • [create-jest] Add npm init / yarn create initialiser for Jest projects (#14465)
  • [jest-validate] Allow deprecation warnings for unknown options (#14499)

Fixes

  • [jest-resolver] Replace unmatched capture groups in moduleNameMapper with empty string instead of undefined (#14507)
  • [jest-snapshot] Allow for strings as well as template literals in inline snapshots (#14465)
  • [@jest/test-sequencer] Calculate test runtime if perStats.duration is missing (#14473)

Performance

  • [@jest/create-cache-key-function] Cache access of NODE_ENV and BABEL_ENV (#14455)

Chore & Maintenance

  • [jest-cli] Move internal config initialisation logic to the create-jest package (#14465)

FAQs

Last updated on 12 Sep 2023

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