0

I'm using npm to handle my dependencies for a typescript project.

In one step of my CI process, I'm performing integration tests. The only dependencies I need for that are Jest and Pactum. Currently I'm running npm install to get the correct versions of those dependencies, but it feels like overkill when I only need two of them. It costs pipeline minutes, and just takes time.

Is there any way to specify install of a dependency and use the version that is defined in the package file?

So like npm install package@version, but I don't want to repeat the version because it is already defined in package.json and will surely break sooner or later. So basically, I'd want to specify another section alongside devDependencies called integrationTestDependencies.

jokarl
  • 1,913
  • 2
  • 24
  • 52
  • Have you considered using npx commands for this? – JBallin May 10 '21 at 14:41
  • I've tried using npx and it suffers from the same issue, it forces me to specify the version again and does not use the semver version from package.json – jokarl May 10 '21 at 14:44
  • Have you tried removing the tilde/caret in package.json before npm install? https://stackoverflow.com/q/41003470/4722345 – JBallin May 10 '21 at 14:44
  • Related suggests third party packages for subsets of deps: https://stackoverflow.com/q/40886871/4722345 – JBallin May 10 '21 at 14:46
  • i'm using caret for parcel for instance, in my package.json that is `^1.12.4`. If I run `npm install` and then `npx parcel --version` I get `1.12.4`. If I remove `node_modules` and run `npx parcel --version` I get `2.0.0-beta.2`. – jokarl May 10 '21 at 14:47
  • I'm sorry, I clicked the first few links that were suggested but I missed that. Both of the suggested dependencies solve my issue, so this is a duplicate. I'll give those a try. Thank you – jokarl May 10 '21 at 14:48
  • Yes thank you, I've flagged this as a duplicate – jokarl May 10 '21 at 16:28

0 Answers0