Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
};
};
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,
};
};