Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

istanbul ignore else #218

Open
ph-fritsche opened this issue Jul 21, 2021 · 4 comments
Open

istanbul ignore else #218

ph-fritsche opened this issue Jul 21, 2021 · 4 comments

Comments

@ph-fritsche
Copy link

  • kcd-scripts version: 11.2.0
  • node version: any
  • npm (or yarn) version: any

Relevant code or config

https://github.com/testing-library/user-event/pull/706/files#diff-79de2fcdb58def5d2000c20beddc4bb5a30488589e20c207181967dd0e75aa72R28

What you did:

Run CI with "kcd-scripts": "^11.1.0".

What happened:

After release of v11.2.0 CI fails due to uncovered lines.
Turns out istanbul expects the /* istanbul ignore else */ right in between else if now.

The pre-commit hook reverts the change and therefore commits fixing this have to be committed with --no-verify.

Reproduction repository:

testing-library/user-event#706

Problem description:

kcd-scripts lint does not flag /* istanbul ignore else */ else if.
kcd-scripts/husky adds a pre-commit hook that changes the (now) correct else /* istanbul ignore else */ if back to /* istanbul ignore else */ else if.

Suggested solution:

Report a lint error for /* istanbul ignore else */ else if.
Lint-fix to else /* istanbul ignore else */ if.

@kentcdodds
Copy link
Owner

I'm not sure I understand what's going on. Is this a linting issue or a prettier issue? Either way I'm not sure what we could do in this project to fix that.

@ph-fritsche
Copy link
Author

It's both
The linter does not report an error for /* istanbul ignore else */ else if although Istanbul does not honor this annotation.
The prettier does change the correct else /* istanbul ignore else */ if to /* istanbul ignore else */ else if.

If we can't fix this in this repo by adjusting some config, then maybe we can relay this problem to the dependency that could fix this.
Otherwise it will serve as a reference for the next poor soul that updates to v11.2 and suddenly has a coverage quota violation without touching code or tests. ;)

@kentcdodds
Copy link
Owner

Yeah, I have no idea what caused the change in behavior and I'm afraid I don't have the bandwidth to investigate it :-/

@eps1lon
Copy link
Contributor

eps1lon commented Sep 12, 2021

We had the same problem in dom-testing-library. I just converted the else if to an else { if }: testing-library/dom-testing-library#1013

ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 18, 2021
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 18, 2021
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 18, 2021
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 19, 2021
* feat: keep track of document state in UI

* programmatically changing value resets UIValue

* prevent stacking of value interceptors

* programmatically changing value resets initial value

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore uncovered `activeElement` being `null`

* intercept calls to `setSelectionRange`

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event

* remove obsolete util

* move modules

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 19, 2021
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 19, 2021
* feat: add `pointer` API

* refactor

* add `pointerMove`

* fix fake event bubbling

* sequences of pointer actions

* default to mouse pointer

* add touch tests

* add enter/leave events on touch down/up

* add tests and handle errors

* add tests

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* add test
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 20, 2021
* feat: keep track of document state in UI

* programmatically changing value resets UIValue

* prevent stacking of value interceptors

* programmatically changing value resets initial value

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore uncovered `activeElement` being `null`

* intercept calls to `setSelectionRange`

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event

* remove obsolete util

* move modules

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 20, 2021
* feat: add `pointer` API

* refactor

* add `pointerMove`

* fix fake event bubbling

* sequences of pointer actions

* default to mouse pointer

* add touch tests

* add enter/leave events on touch down/up

* add tests and handle errors

* add tests

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* add test
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 21, 2021
* feat: keep track of document state in UI

* programmatically changing value resets UIValue

* prevent stacking of value interceptors

* programmatically changing value resets initial value

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore uncovered `activeElement` being `null`

* intercept calls to `setSelectionRange`

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event

* remove obsolete util

* move modules

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event
ph-fritsche added a commit to testing-library/user-event that referenced this issue Oct 21, 2021
* feat: add `pointer` API

* refactor

* add `pointerMove`

* fix fake event bubbling

* sequences of pointer actions

* default to mouse pointer

* add touch tests

* add enter/leave events on touch down/up

* add tests and handle errors

* add tests

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants