Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about istanbul

Read more about istanbul

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - istanbul

React Jest Unit Testing await in private function uncovered line

I call a async function in useEffect const [documents, setDocuments] = useState(Array()); async function findDocuments() { const res = await findDocumentList([], {}); setDocuments(res.data...
test-img

MareCieco

jestjs

code-coverage

istanbul

Votes: 0

Answers: 1

Latest Answer

The coverage report needs every async function to have an await on it: await findDocuments()
test-img

Brent Washburne

How to ignore the catch clause of a promise in Jest test coverage?

In my unit tests I have one case where I get a promise from a browser API (IndexedDB) and added a catch clause to handle any error condition. For obvious reasons I cannot trigger the promise to fail i...
test-img

Mike Lischke

jestjs

istanbul

Votes: 0

Answers: 1

Latest Answer

The place to add the ignore hint is directly before the closure in the catch clause: Promise.all([promise1, promise2]).then(() => { ... }).catch(/* istanbul ignore next */(reason) => { ...
test-img

Mike Lischke

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved