How to use the execa.mockClear function in execa

To help you get started, we’ve selected a few execa 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 nklayman / vue-cli-plugin-electron-builder / __tests__ / commands.spec.js View on Github external
await runCommand('electron:serve', {}, {}, [...args, '--keep2'])
      // Custom args should have been removed, and other args kept
      calledArgs = execa.mock.calls[0][1]
      // Remove dist_electron
      calledArgs.shift()
      expect(calledArgs).toEqual(['--keep2'])
      execa.mockClear()

      await runCommand('electron:serve', {}, {}, ['--keep1', ...args])
      // Custom args should have been removed, and other args kept
      calledArgs = execa.mock.calls[0][1]
      // Remove dist_electron
      calledArgs.shift()
      expect(calledArgs).toEqual(['--keep1'])
      execa.mockClear()

      await runCommand('electron:serve', {}, {}, args)
      // Custom args should have been removed
      calledArgs = execa.mock.calls[0][1]
      // Remove dist_electron
      calledArgs.shift()
      expect(calledArgs).toEqual([])
      execa.mockClear()

      await runCommand('electron:serve', {}, {}, ['--keep1', '--keep2'])
      // Nothing should be removed
      calledArgs = execa.mock.calls[0][1]
      // Remove dist_electron
      calledArgs.shift()
      expect(calledArgs).toEqual(['--keep1', '--keep2'])
      execa.mockClear()
github primer / publish / src / __tests__ / publish.js View on Github external
afterEach(() => {
    restoreEnv()
    execa.mockClear()
    readJSON.mockClear()
  })
github okonet / lint-staged / test / runScript.spec.js View on Github external
beforeEach(() => {
    resolveGitDir.mockClear()
    mockFn.mockClear()
  })
github okonet / lint-staged / test / resolveTaskFn-chunked.spec.js View on Github external
afterEach(() => {
      execa.mockClear()
      pMap.mockClear()
    })