Skip to content

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

Open
@faxg

Description

@faxg

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.

Activity

Redhorse7422

Redhorse7422 commented on Jan 15, 2024

@Redhorse7422

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

r1tsuu

r1tsuu commented on Mar 29, 2024

@r1tsuu
Member

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

cgilly2fast commented on Sep 1, 2024

@cgilly2fast

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

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

        Participants

        @faxg@cgilly2fast@Redhorse7422@r1tsuu

        Issue actions

          "yarn test" - Command "test" not found · Issue #6 · payloadcms/plugin-template