Template using Webpack and Babel to enable ES6 features in k6 tests
89
stars
21
commits
JavaScript
primary language
Jun 2, 2026
updated
[!WARNING] This template is deprecated and this repository is archived.
k6 has native ES6+ and TypeScript support since v0.52.0 (released June 2024). Set the
--compatibility-mode=experimental_enhancedoption to use it, and check the documentation for the details. TheBabel/Webpackbundling described below is no longer necessary; the contents are kept for historical reference only.
This is a template repository showing how to use Babel and Webpack to bundle the different files into CommonJS modules, using its webpack.config.js configuration.
In this project, you can write k6 tests using:
?. ) operator.Click Use this template to create a repository from this template.
Clone the generated repository on your local machine, move to the project root folder and install the dependencies defined in package.json
npm install
Attempting to run the tests in src will fail because:
?. ) operator.To address this, we'll use Webpack to bundle the dependencies and polyfill ES+ features.
npm run bundle
This command creates the final test files to the ./dist folder.
Once that is done, we can run our script the same way we usually do, for instance:
k6 run dist/optional-chaining-test.js
# or
k6 run dist/faker-test.js
JavaScript
100.0%
Template using Webpack and Babel to enable ES6 features in k6 tests
89
stars
21
commits
JavaScript
primary language
Jun 2, 2026
updated
[!WARNING] This template is deprecated and this repository is archived.
k6 has native ES6+ and TypeScript support since v0.52.0 (released June 2024). Set the
--compatibility-mode=experimental_enhancedoption to use it, and check the documentation for the details. TheBabel/Webpackbundling described below is no longer necessary; the contents are kept for historical reference only.
This is a template repository showing how to use Babel and Webpack to bundle the different files into CommonJS modules, using its webpack.config.js configuration.
In this project, you can write k6 tests using:
?. ) operator.Click Use this template to create a repository from this template.
Clone the generated repository on your local machine, move to the project root folder and install the dependencies defined in package.json
npm install
Attempting to run the tests in src will fail because:
?. ) operator.To address this, we'll use Webpack to bundle the dependencies and polyfill ES+ features.
npm run bundle
This command creates the final test files to the ./dist folder.
Once that is done, we can run our script the same way we usually do, for instance:
k6 run dist/optional-chaining-test.js
# or
k6 run dist/faker-test.js
JavaScript
100.0%