How to use the jest-watcher.JestHook function in jest-watcher

To help you get started, we’ve selected a few jest-watcher examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sikidamjanovic / cowrite / node_modules / jest-watch-typeahead / build / test_utils / pluginTester.js View on Github external
const pluginTester = (Plugin, config = {}) => {
  const stdout = {
    columns: 80,
    write: jest.fn()
  };
  const jestHooks = new _jestWatcher.JestHook();
  const plugin = new Plugin({
    stdout,
    config
  });
  plugin.apply(jestHooks.getSubscriber());

  const type = (...keys) => keys.forEach(key => plugin.onKey(key));

  return {
    stdout,
    hookEmitter: jestHooks.getEmitter(),
    updateConfigAndRun: jest.fn(),
    plugin,
    type
  };
};
github jest-community / jest-watch-typeahead / src / test_utils / pluginTester.js View on Github external
const pluginTester = (Plugin, options = {}) => {
  const stdout = {
    columns: (options.stdout || {}).columns || 80,
    write: jest.fn(),
  };
  const jestHooks = new JestHook();
  const plugin = new Plugin({ stdout, config: options.config });
  plugin.apply(jestHooks.getSubscriber());

  const type = (...keys) => keys.forEach(key => plugin.onKey(key));

  return {
    stdout,
    hookEmitter: jestHooks.getEmitter(),
    updateConfigAndRun: jest.fn(),
    plugin,
    type,
  };
};

jest-watcher

Delightful JavaScript Testing.

MIT
Latest version published 1 year ago

Package Health Score

88 / 100
Full package analysis

Similar packages