How to use the git-raw-commits.mockImplementationOnce function in git-raw-commits

To help you get started, we’ve selected a few git-raw-commits 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 frinyvonnick / gitmoji-changelog / packages / gitmoji-changelog-core / src / index.spec.js View on Github external
function mockNoCommits() {
  gitRawCommits.mockReset()

  gitRawCommits.mockImplementationOnce(() => {
    const stream = require('stream')
    const readable = new stream.Readable()
    readable.push(null)
    readable.emit('close')
    return readable
  })
}
github frinyvonnick / gitmoji-changelog / packages / gitmoji-changelog-core / src / index.spec.js View on Github external
function mockGroup(commits) {
  gitRawCommits.mockImplementationOnce(() => {
    const stream = require('stream')
    const readable = new stream.Readable()
    commits.forEach(commit => {
      const {
        hash, author, date, subject, body,
      } = commit
      readable.push(`\n${hash}\n${author}\n${date}\n${subject}\n${body}\n`)
    })
    readable.push(null)
    readable.emit('close')
    return readable
  })
}

git-raw-commits

Get raw git commits out of your repository using git-log(1).

ISC
Latest version published 8 months ago

Package Health Score

87 / 100
Full package analysis