volto icon indicating copy to clipboard operation
volto copied to clipboard

Fix updating snapshots on pnpm test

Open Hrittik20 opened this issue 1 year ago • 4 comments

Fixes: #5783

Hrittik20 avatar May 20 '24 08:05 Hrittik20

Deploy Preview for plone-components canceled.

Name Link
Latest commit 88fe392fdc62e8f7d1f08792353ee9735acdc38e
Latest deploy log https://app.netlify.com/sites/plone-components/deploys/664b08d0365f8a0008dc15fb

netlify[bot] avatar May 20 '24 08:05 netlify[bot]

@Hrittik20 adding the -u flag means you update the snapshots regardless if you want todo that or not. You want to run the test, see that it fails because most of the time you made a mistake and hence tests fail. There are instances where yes you make changes that require testing snapshot update but then you can mention that you want to update the test.

You didn't understand the issue @ksuess added and what she proposed.

If you look there are :ci commands https://github.com/plone/volto/blob/main/package.json#L18 and non :ci commands. She proposes to modify the test command to use the test from packages/volto https://github.com/plone/volto/blob/main/packages/volto/package.json#L43 and add a new test:ci command where test:ci from packages/volto is used.

This way if someone runs the tests from the root of the monorepo they can update the tests since the test run allows to select the action todo run-mode

ichim-david avatar May 20 '24 15:05 ichim-david

@ichim-david Apologies for the misunderstanding. So will the issue be solved if I modified package.json like this : "test": "pnpm --filter @plone/volto run test", "test:ci": "pnpm --filter @plone/volto run test:ci",

Hrittik20 avatar May 21 '24 07:05 Hrittik20

@ichim-david Apologies for the misunderstanding. So will the issue be solved if I modified package.json like this : "test": "pnpm --filter @plone/volto run test", "test:ci": "pnpm --filter @plone/volto run test:ci",

@Hrittik20 You have to check where pnpm test is used and modify those instances to use pnpm test:ci command which you will add besides modifying the current test command

ichim-david avatar May 21 '24 08:05 ichim-david

@Hrittik20 you can use:

pnpm test -- -u

It does the trick, by passing args to pnpm scripts (as it did always, it's not a pnpm trick). If you do not mind, I'd close this one.

sneridagh avatar May 27 '24 09:05 sneridagh