jeudi 2 janvier 2020

Mocking execSync in Jest

How do I mock out executing a child process in Jest

const execSync = require('child_process').execSync;
//...
expect(execSync)
  .toHaveBeenCalledWith('npm install');

But not actually have it run the npm install during the test.

Aucun commentaire:

Enregistrer un commentaire