pulumi/sdk/nodejs/npm
bors[bot] 6f0ee42b7c
Merge #13033
13033: test(sdk/npm): Don't download from NPM or Yarn regstries r=Frassle a=abhinav

Follow up to #12983

Tests that download from NPM or Yarn will be brittle, unsafe, and slow.
We don't need to hit these servers directly.

This change alters the package installation tests to
set up a local HTTP server that implements a subset of the
[NPM Package Registry API][1] -- just enough to satisfy these tests.

  [1]: https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md

In the tests, we'll set `$HOME` to a new temporary directory and write
an `~/.npmrc` or `~/.yarnrc` requesting use of the local server as the
registry.

With this, the tests are entirely local. No external requests.

Also contains minor fix-ups to the test that were pointed out in #12983:

- Use 'require' in chdir
- Use subtests for `Test*Install`
- Don't send command output to /dev/null

These fix-ups are in separate commits to keep the meat of this change
independently reviewable.


Co-authored-by: Abhinav Gupta <abhinav@pulumi.com>
2023-05-29 18:29:29 +00:00
..
manager.go Add unit test for npm installation. 2023-05-26 11:43:22 -04:00
manager_test.go test(sdk/npm): Don't send command output to /dev/null 2023-05-26 14:12:29 -07:00
npm.go Add unit test for npm installation. 2023-05-26 11:43:22 -04:00
npm_test.go Fix TestNPMInstallCmd 2023-05-29 14:16:23 +01:00
yarn.go Add unit test for npm installation. 2023-05-26 11:43:22 -04:00