NPM packages are used in JavaScript and provide developers with tools, libraries, and frameworks to enhance software development. They offer solutions for everything from generating synthetic data and handling authentication to connecting with databases, APIs, and other services.

With Multiple, you can use NPM packages directly in your load test scripts. As such, if you’re using an NPM package already in your codebase, you can paste your existing code into Multiple.

Start by importing any required modules at the top of your test script, similarly to how you would in any other JavaScript application. For example:

import { gql, GraphQLClient, request } from 'graphql-request';

Next, add the list of NPM package dependencies to the npmDeps property of the Test Spec class, and be sure to include both the package name and package version.

For example:

class GraphQLTestSpec {
  npmDeps = {
    graphql: '16.6.0',
    'graphql-request': '6.0.0',
  };

  // Rest of the test spec
}

Multiple only works with Node-compatible NPM packages. Packages that rely on browser APIs or pure ESM packages are not supported.