Using Private NPM Modules

If your test scripts make use of custom JS code which depends on private modules, you can enable private npm module support in Artillery Pro by setting a couple of confguration options.

Private npm module support is available in Artillery Pro v2.2.0-0 and is considered a BETA feature. If you run into any issues, please get in touch on support@artillery.io and we will work with you to address the problem.

Configure private npm access

Set npm token

If you want to use a private package hosted on npmjs.com, you need to configure an npm token that Artillery Pro can use to fetch your private packages. Please refer to npm docs for information on how to create a token. We recommend that you create a read-only token to follow security best-practices.

Once you have a token, use the artillery set-config-value command to make it available to Artillery Pro.

NOTE: the region in which Artillery Pro backend is deployed by your team must be used in place of eu-west-1 in the following example:

artillery set-config-value --name NPM_TOKEN --value 01234567890-token-from-npm-012345 --region eu-west-1

The value of the token is encrypted and stored securely in AWS Parameter Store and can only be read by Artillery Pro tests.

Set npm registry URL

If your organization uses a self-hosted NPM registry, the URL for the registry can be configured with NPM_REGISTRY config value.

NOTE: the region in which Artillery Pro backend is deployed by your team must be used in place of eu-west-1 in the following example:

artillery set-config-value --name NPM_REGISTRY --value https://npmregistry.internal --region eu-west-1

Running tests which use private modules

Once NPM_TOKEN / NPM_REGISTRY values have been configured, tests making use of private modules can be run as normal with artillery run-test command. No changes to the test scripts are required.