Skip to content

support c8 ignore start, c8 ignore stop #271

Description

@connorjclark

Since ignore AST nodes isn't an option, ignoring functions becomes difficult:

/* c8 ignore next 11 */
function wrapRuntimeEvalErrorInBrowser(err) {
  err = err || new Error();
  const fallbackMessage = typeof err === 'string' ? err : 'unknown error';

  return {
    __failedInBrowser: true,
    name: err.name || 'Error',
    message: err.message || fallbackMessage,
    stack: err.stack || (new Error()).stack,
  };
}

Most changes to this function will require modifying the ignore comment.

With istanbul it's trivial:

/* istanbul ignore next */
function wrapRuntimeEvalErrorInBrowser(err) {
  err = err || new Error();
  const fallbackMessage = typeof err === 'string' ? err : 'unknown error';

  return {
    __failedInBrowser: true,
    name: err.name || 'Error',
    message: err.message || fallbackMessage,
    stack: err.stack || (new Error()).stack,
  };
}

But no AST. instead, what about a "start ignoring" & "stop ignoring" comment?

Activity

  1. bcoe commented on Dec 22, 2020

    @bcoe
    Owner

    @connorjclark this seems like a reasonable compromise on not being able to ignore specific Node types.

    I've been hesitant to want to introduce a JavaScript parser to the codebase.

  2. added a commit that references this issue on Dec 30, 2020
    90949fa
  3. added a commit that references this issue on Feb 2, 2024
    415e26e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions