Socket
Socket
Sign inDemoInstall

jest-watcher

Package Overview
Dependencies
3
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-watcher


Version published
Weekly downloads
25M
decreased by-1.12%
Maintainers
1
Install size
132 kB
Created
Weekly downloads
 

Package description

What is jest-watcher?

The jest-watcher package is a part of the Jest ecosystem and is used to implement custom watch plugins for Jest. It provides an API to create plugins that can hook into Jest's watch mode, allowing developers to add custom watch behaviors to their test suites.

What are jest-watcher's main functionalities?

Custom Watch Plugins

This feature allows developers to create custom watch plugins that can react to file changes, determine if a test suite should run, and more. The code sample shows a basic structure of a custom watch plugin.

class MyCustomPlugin {
  apply(jestHooks) {
    jestHooks.onFileChange(({ projects }) => {
      console.log('Files changed:', projects[0].changedFiles);
    });
    jestHooks.shouldRunTestSuite(() => true);
  }
}

module.exports = MyCustomPlugin;

Interactive Watch Plugins

This feature allows the creation of interactive watch plugins that can provide custom interactive CLI interfaces during Jest's watch mode. The code sample demonstrates how to implement an interactive behavior that filters tests based on a pattern.

class MyInteractivePlugin {
  run(globalConfig, updateConfigAndRun) {
    // Implement interactive behavior here
    updateConfigAndRun({
      testNamePattern: 'pattern to filter tests'
    });
    return Promise.resolve();
  }
}

module.exports = MyInteractivePlugin;

Other packages similar to jest-watcher

Changelog

Source

23.1.0

Features

  • [jest-each] Add pretty-format serialising to each titles (#6357)
  • [jest-cli] shouldRunTestSuite watch hook now receives an object with config, testPath and duration (#6350)
  • [jest-each] Support one dimensional array of data (#6351)
  • [jest-watch] create new package jest-watch to ease custom watch plugin development (#6318)
  • [jest-circus] Make hooks in empty describe blocks error (#6320)
  • Add a config/CLI option errorOnDeprecated which makes calling deprecated APIs throw hepful error messages (#6339)

Fixes

  • [jest-each] Fix pluralising missing arguments error (#6369)
  • [jest-each] Stop test title concatenating extra args (#6346)
  • [expect] toHaveBeenNthCalledWith/nthCalledWith gives wrong call messages if not matched (#6340)
  • [jest-each] Make sure invalid arguments to each points back to the user's code (#6347)
  • [expect] toMatchObject throws TypeError when a source property is null (#6313)
  • [jest-cli] Normalize slashes in paths in CLI output on Windows (#6310)
  • [jest-cli] Fix run beforeAll in excluded suites tests" mode. (#6234)
  • [jest-haste-map] Compute SHA-1s for non-tracked files when using Node crawler (#6264)

Chore & Maintenance

  • [docs] Improve documentation of mockClear, mockReset, and mockRestore (#6227)
  • [jest-each] Refactor each to use shared implementation with core (#6345)
  • [jest-each] Update jest-each docs for serialising values into titles (#6337)
  • [jest-circus] Add dependency on jest-each (#6309)
  • [filenames] Rename "integration-tests" to "e2e" (#6315)
  • [docs] Mention the use of commit hash with --changedSince flag (#6330)

FAQs

Last updated on 30 May 2018

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc