🖌️
Product Process Documentation
  • Product Process Documentation
  • Definition of Done (DoD)
    • General checkpoints
      • Specific checkpoints by team
    • Important process: QA review & PO review
      • QA Review
      • PO Review
  • Work Items
    • Product Backlog Item (PBI)
    • Bug
      • Basic rules for creating a bug
      • How to report a Bug
    • Bugs Management
  • Code Standards
  • Different Test Levels
    • Unit Test
      • Frontend Unit Testing
        • What is a Unit Test?
        • How do I know if I am developing a good unit test?
        • AAA (Arrange, Act and Assert)
        • Overloaded test suits
        • Setup & Teardown
          • JEST Mocks
          • FakeTimers
        • Istanbul Annotations
        • C8 Annotations
        • JEST Runner (Debug unit tests with Jest)
    • Component Test
      • Frontend Component Testing
        • What is Component Testing?
        • Best practices
        • Bad practices
        • Setup
          • Sandbox
          • Mocks, Services and Providers
          • Test scenario
    • Integration Test
      • Frontend Integration Testing
        • What is a Integration Test?
        • AAA (Arrange, Act and Assert)
        • Best Practices
        • Bad practices
        • Setup & Teardown
        • How to create a scenario
          • Create the migrated app
          • Add to project
        • How to debug
        • Common problems
      • Testing Driven Development Guide and recommendations
    • Functional Test
    • Security Testing
      • Security Testing Tools
      • Frontend Security Testing
    • Performance testing
    • Best Practices
    • Test Documentation
  • Run test projects
    • General steps
    • Specific steps by team
  • DevOps
    • Pipelines
    • Builds
    • Specific information by team
    • Test plan
    • Service Hooks for Azure DevOps Notifications
      • Slack Notifications
      • Microsoft Teams Notifications
  • Dashboards
    • General
    • QA Dashboards
  • Release Process
    • General Steps
    • Specific steps by team
  • Migration Cells
    • Basics of testing process
  • Release process
  • References
Powered by GitBook
On this page
  • Ignoring the next line
  • Ignoring the next N lines
  • Ignoring all lines until told
  • Ignoring a block on the current line

Was this helpful?

  1. Different Test Levels
  2. Unit Test
  3. Frontend Unit Testing

C8 Annotations

V8 Coverage provider annotations are similar as Istanbul.

Ignoring the next line

const myVariable = 99;
/* c8 ignore next */
if (process.platform === 'win32') console.info('hello world');

Unlike istanbul, this annotation only ignores one line.

Ignoring the next N lines

const myVariable = 99;
/* c8 ignore next 3 */
if (process.platform === 'win32') {
  console.info('hello world');
}

Ignoring all lines until told

/* c8 ignore start */
function dontMindMe() {
  // ...
}
/* c8 ignore stop */

/* c8 ignore else */ is only working without else statement:

So when you have an else statement should proceed as follow:

if (process.platform === 'win32') {
  console.info('hello world');
} /* c8 ignore start*/ else {
  console.info('hello');
} /* c8 ignore stop */

Another little difference with this is, c8 marks it in the coverage report when istanbul doesn't.

Ignoring a block on the current line

const myVariable = 99;
const os = process.platform === 'darwin' ? 'OSXy' /* c8 ignore next */ : 'Windowsy';

This is useful when you want to ignore else statement for example.

PreviousIstanbul AnnotationsNextJEST Runner (Debug unit tests with Jest)

Last updated 2 years ago

Was this helpful?

Istanbul example
C8 example