Some projects organize packages in multi-packages repositories or monorepos. E2E testing is a topic that usually is only relevant for User Interfaces, but from a Node.js perspective, publishing packages also need to be tested.
Such approach has been really hard to achieve considering:
- Populate canary packages on public services seems not to be a good idea
- Some self-hosted OSS registries are too heavy
- Offline environments (private networks)
Verdaccio is a lightweight registry with zero-configuration that fits perfectly in any E2E + CI workflow.
There is no a silver bullet yet, each implementation seems to be specific for each project, you can check some of them in the following thread clicking here.
This is the most simple example using Verdaccio in a bash script (extracted from create-react-app).
#!/bin/sh set -e local_registry="http://0.0.0.0:4873" # start local registrytmp_registry_log=`mktemp`sh -c "mkdir -p $HOME/.config/verdaccio"sh -c "cp --verbose /config.yaml $HOME/.config/verdaccio/config.yaml"sh -c "nohup verdaccio --config $HOME/.config/verdaccio/config.yaml &>$tmp_registry_log &"# wait for `verdaccio` to bootgrep -q 'http address' <(tail -f $tmp_registry_log)# login so we can publish packagessh -c "npm-auth-to-token -u test -p test -e firstname.lastname@example.org -r $local_registry"# Run nmp commandsh -c "npm --registry $local_registry publish"