How to use the p-map.mockImplementation function in p-map

To help you get started, we’ve selected a few p-map 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 okonet / lint-staged / test / runScript-mock-pMap.spec.js View on Github external
it('should handle unexpected error', async () => {
    expect.assertions(1)
    pMapMock.mockImplementation(() => Promise.reject(new Error('Unexpected Error')))

    const [linter] = runScript(['test'], ['test.js'])
    try {
      await linter.task()
    } catch (err) {
      expect(err.message).toMatch(dedent`
        ${logSymbols.error} test got an unexpected error.
        Unexpected Error
      `)
    }
  })
})

p-map

Map over promises concurrently

MIT
Latest version published 7 months ago

Package Health Score

78 / 100
Full package analysis