How to use the cross-spawn.mockImplementation function in cross-spawn

To help you get started, we’ve selected a few cross-spawn 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 smollweide / lerna-terminal / src / runNpmScript / index.spec.js View on Github external
it('stop() -> kill', done => {
		spawn.mockImplementation(() => ({
			stdout: {
				on() {},
			},
			stderr: {
				on() {},
			},
			on(value, cb) {
				cb();
			},
			kill() {},
		}));
		const _options = Object.assign({}, options);
		global.process.kill = () => {
			done();
		};
		runNpmScript(_options).stop();