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

"yarn test" - Command "test" not found #6

Open
faxg opened this issue Jan 13, 2024 · 3 comments
Open

"yarn test" - Command "test" not found #6

faxg opened this issue Jan 13, 2024 · 3 comments

Comments

@faxg
Copy link

faxg commented Jan 13, 2024

Maybe I'm missing something super obvious, but:

  • Create new plugin project: npx create-payload-app@latest -t plugin -n myPlugin
  • cd myPlugin
  • yarn test

leads to ===>

$ cd dev && yarn test error Command "test" not found.

Looking at the package.json inside the dev folder explains the error - there is no "test" script there.

@Redhorse7422
Copy link

Hi i am facing this same issue have you got any solution for that ?

@r1tsuu
Copy link
Member

r1tsuu commented Mar 29, 2024

it's because dev folder doesn't have test command, you can run yarn jest in the root folder or install jest to dev package.json. But tests still won't run because you need to somehow configure it to work with Payload local api. Would be great if we had this pre-configured (like in Payload repository), tests are making our plugins code base much better. While you can keep a plugin that only adds some ui without tests (e2e front end isn't worth imo), but when plugin does business logic with database you should write integration tests.

@cgilly2fast
Copy link

I just made a PR fixing this issue: https://github.com/payloadcms/plugin-template/pulls

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

4 participants