Skip to content

Error when running pre-commit hook in this repo #696

@TrevorBurnham

Description

@TrevorBurnham
  • @testing-library/jest-dom version: N/A
  • node version: v22.18.0
  • jest (or vitest) version: N/A
  • npm (or yarn) version: yarn 1.22.22

What you did:

I did a fresh clone of the repo (HEAD is 779b712), ran npm run setup -s as instructed by CONTRIBUTING.md, then made some changes in src/to-be-visible.js and ran git commit.

What happened:

The pre-commit hook failed:

$ git commit
husky > pre-commit (node v22.18.0)
✔ Preparing lint-staged...
⚠ Running tasks for staged files...
  ❯ node_modules/kcd-scripts/dist/config/lintstagedrc.js — 1 file
    ↓ README.md — no files [SKIPPED]
    ❯ *.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|gql|graphql|mdx|vue) — 1 file
      ✔ kcd-scripts format
      ✔ kcd-scripts lint
      ✖ kcd-scripts test --findRelatedTests [FAILED]
↓ Skipped because of errors from tasks. [SKIPPED]
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ kcd-scripts test --findRelatedTests:
● Validation Warning:

  Unknown option "watchPlugins" with value ["/Users/trevor.burnham/code/jest-dom/node_modules/jest-watch-typeahead/build/file_name_plugin/plugin.js", "/Users/trevor.burnham/code/jest-dom/node_modules/jest-watch-typeahead/build/test_name_plugin/plugin.js"] was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

● Validation Warning:

  Unknown option "watchPlugins" with value ["/Users/trevor.burnham/code/jest-dom/node_modules/jest-watch-typeahead/build/file_name_plugin/plugin.js", "/Users/trevor.burnham/code/jest-dom/node_modules/jest-watch-typeahead/build/test_name_plugin/plugin.js"] was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /Users/trevor.burnham/code/jest-dom
  0 files checked across 2 projects. Run with `--verbose` for more details.
Pattern: /Users/trevor.burnham/code/jest-dom/src/to-be-visible.js - 0 matches
husky > pre-commit hook failed (add --no-verify to bypass)

Reproduction:

I was able to reproduce in CodeSandbox: https://codesandbox.io/p/github/TrevorBurnham/jest-dom/main?import=true

Rather than running git commit, can run the underlying script directly with this command:

yarn exec kcd-scripts -- test --watch=false --findRelatedTests -- src/to-be-visible.js

Problem description:

This bug is an impediment to contributing to this project.

Suggested solution:

Not sure. I tried upgrading kcd-scripts from 14.0.1 to 16.0.0, but I observed the same behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions