Skip to content

Component test pnpm scaffolding uses pnpm install not add #29052

@MikeMcC399

Description

@MikeMcC399

Current behavior

When scaffolding Cypress Component Testing in the presence of a pnpm-lock.yaml file from the pnpm package manager Cypress outputs a command string to instruct the user to install dependencies which starts with pnpm install. For instance, if "Vue CLI (Vue 3)" is selected as a front-end framework, the suggested installation command is:

pnpm install -D @vue/cli-service vue

Desired behavior

Cypress Component Testing scaffolding for pnpm environments should prepend the following command to the framework modules to be installed:

pnpm add -D

instead of pnpm install -D.

Although pnpm install appears to install the dependencies listed, it is not the documented way to do this ("pnpm install is used to install all dependencies for a project."). The description for pnpm add <pkg> says "Installs a package and any packages that it depends on. By default, any new package is installed as a production dependency.".

Cypress should not rely on an undocumented method to add packages using pnpm. pnpm install is undocumented for this purpose, whereas pnpm add is documented as the method to add packages.

Test code to reproduce

In a terminal window, execute:

npm install pnpm@latest -g
mkdir cy-pnpm-ct
cd cy-pnpm-ct
git init
pnpm init
pnpm add cypress -D
pnpm cypress open

Select "Component Testing"
Select "Front-end framework" > "Vue CLI (Vue 3)"
Click "Next step"
Note the instruction

pnpm install -D @vue/cli-service vue

Paste the instruction into a separate terminal window and execute it.

Note that it runs successfully.

Cypress Version

13.6.6

Node version

v20.11.1

Package manager and version

pnpm 8.15.4

Operating System

Ubuntu 22.04.4 LTS

Debug Logs

$ pnpm install -D @vue/cli-service vue
 WARN  3 deprecated subdependencies found: [email protected], [email protected], [email protected]
Packages: +547
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 724, reused 641, downloaded 82, added 547, done

devDependencies:
+ @vue/cli-service 5.0.8
+ vue 3.4.21

Done in 15.1s

Other

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/launchpadThis is due to an issue in the packages/launchpad directorytype: user experienceImprovements needed for UX

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions