How to use the read-pkg-up.mockImplementationOnce function in read-pkg-up

To help you get started, we’ve selected a few read-pkg-up 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-cli / src / presets / node.spec.js View on Github external
it('should extract github repo info from package.json', async () => {
    readPkgUp.mockImplementationOnce(() => Promise.resolve({
      pkg: {
        name: 'gitmoji-changelog',
        version: '0.0.1',
        description: 'Gitmoji Changelog CLI',
      },
    }))

    const result = await loadProjectInfo()

    expect(result).toEqual({
      name: 'gitmoji-changelog',
      version: '0.0.1',
      description: 'Gitmoji Changelog CLI',
    })
  })
})

read-pkg-up

Read the closest package.json file

MIT
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis