How to use the cross-spawn.mock 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 Yoctol / bottender / packages / bottender / src / cli / providers / sh / __tests__ / init.spec.js View on Github external
it('should call spawn with yarn if useYarn is false', async () => {
      execSync.mockImplementation(() => {
        throw new Error('Error!');
      });
      inquirer.prompt.mockResolvedValueOnce({
        name: 'newbot',
        platform: 'messenger',
        session: 'redis',
        server: 'express',
      });

      await init();

      expect(spawn.mock.calls).toContainEqual([
        'npm',
        ['install', '--dev', '--save-exact', '--loglevel', 'error', 'nodemon'],
        { stdio: 'inherit' },
      ]);
    });
  });