

For more details on the performance benefits of running in the base compatibility mode, see this article. When bundling using the configuration described in this article, babel and corejs automatically adds the features needed, thus allowing us to run our script without these extensions, using -compatibility-mode=base. In k6, however, every VU has a separate javascript virtual machine, duplicating the resource usage once each.īy running code requiring additional features on top of ES5.1, we also need additional extensions to the javascript vm, further boosting the resource usage. Usually, this is not a big problem as each application only allocates these resources once. In general, all external modules added to a test project have a negative impact on performance, as they further increase the memory footprint and CPU usage. Specific reason to choose something else. With k6, it is recommended to use webpack unless you have a Popular ones include, but are notĭue to its flexibility, ease of use, relatively low resource consumption, and known compatibility It is possible to use any bundler that supports transpilation. Or only uses ES5.1+ features, using a bundler will not be necessary. If the test script has no external dependencies, already has them vendored in a k6 compatible way, Identifies all external dependencies, and then continues to create a self-contained bundle including This is done with the help of a bundling tool, like Webpack, which analyses the test script, Node modules that resolve external dependencies will first need to be transformed into a self-contained, Any node_modules folder in a parent directory, up to the closest package.json file.Īs the implementation of import in k6 lacks support for the node module resolution algorithm,.Any node_modules folder in the directory.Would be automatically resolved by the node resolution algorithm by searching: This means that the developer can import modulesīy name, without providing the full filesystem path to the module. Using the node module resolution algorithm. In a javascript project running NodeJS, modules are imported using either import or require(), The steps of this tutorial are as follows:Ī ready-to-use Webpack and Babel starter is available on GitHub. Instance the os and fs modules, will not work in k6. Packages that rely on APIs provided by NodeJS, for Bundling node modules ⚠️ Limited compatibility These libraries can either be downloaded and included with the test project or loaded directly using HTTP imports as shown above. JSLib is a set of libraries known to play nicely with k6, and available at.
