payloadcms / plugin-template

A template for creating your own Payload plugin
MIT License
23 stars 14 forks source link

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

Open faxg opened 10 months ago

faxg commented 10 months ago

Maybe I'm missing something super obvious, but:

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 commented 10 months ago

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

r1tsuu commented 7 months ago

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 commented 2 months ago

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