Skip to content

Use well-defined npm script names instead of custom #303

Open
@aentwist

Description

@aentwist

Description

npm provides both npm start and npm test. Use these instead of npm run dev and npm run test:unit.

Considerations

Maybe there are different layers of tests. So then keep test:unit + others, and add "test": "run-p test:unit ..."

Activity

cexbrayat

cexbrayat commented on Nov 10, 2023

@cexbrayat
Member

@aentwist Thanks for the suggestion

Maybe we could add npm start as an alias for npm run dev and npm test as an alias for npm run test:unit.
This is what Angular CLI does for example.

Would you like to try and open a PR?

szgabsz91

szgabsz91 commented on Nov 18, 2023

@szgabsz91

Hi @cexbrayat,

If this issue is still available, I think I could open a PR.

However, I'm not sure if I understand correctly that you suggest we should keep the dev script, too? Wouldn't it be weird if a newly generated package.json contained two scripts for the same command?

When I saw this issue, I thought about the following steps:

  • rename the dev script to start,
  • keep the current test:unit and test:e2e scripts if they are generated,
  • generate a new test script that either executes
    • test:unit if only unit tests are generated (vitest, cypress-ct or nightwatch-ct)
    • test:e2e if only E2E tests are generated (cypress, nightwatch or playwright)
    • both test:unit and test:e2e if unit AND E2E tests are generated

What do you think?

cexbrayat

cexbrayat commented on Nov 20, 2023

@cexbrayat
Member

I was thinking that it would be better to keep the existing ones to avoid all the tooling/docs/blog posts/books to reference commands that no longer exist.

So I would:

  • add start along dev
  • keep the current test:unit and test:e2e scripts if they are generated
  • add test as an alias of test:unit, except if only e2e tests are generated, and in that case, as an alias of test:e2e
szgabsz91

szgabsz91 commented on Nov 20, 2023

@szgabsz91

OK, it's clear now. :) Then I'll take a look into it and open a PR soon, adding you as the reviewer if that's OK.

linked a pull request that will close this issue on Nov 25, 2023
evandrofgarcia

evandrofgarcia commented on Jun 20, 2024

@evandrofgarcia

I don’t receive

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @cexbrayat@szgabsz91@aentwist@evandrofgarcia

      Issue actions

        Use well-defined npm script names instead of custom · Issue #303 · vuejs/create-vue