-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Feature Description
TypeScript has become increasingly popular for its strong typing system, which enhances code quality and reliability—key aspects in performance testing scenarios. Currently, k6 does not support TypeScript out-of-the-box, requiring users to rely on external tools to transpile TypeScript code into JavaScript before it can be run by the tool. This additional step not only complicates the setup process but also impacts the overall developer experience, especially for those who primarily work with TypeScript. This setup also discourages TypeScript developers from adopting k6, despite its powerful testing capabilities.
Suggested Solution (optional)
To address the current gap, I suggest integrating k6pack, a solution based on esbuild, into the core functionality of k6. esbuild is a TypeScript transpiler and bundler written in Go, which aligns well with k6’s Go-based architecture. The integration would involve automatically invoking k6pack during the k6 launch process to transpile TypeScript scripts into executable JavaScript.
This integration can be structured as follows:
- Automatic Detection: k6 should automatically detect TypeScript files (.ts/.tsx) and invoke k6pack.
- Seamless Transpilation: Behind the scenes, k6pack uses esbuild to transpile TypeScript to JavaScript, handling any necessary bundling and minification. This process should be transparent to the user, requiring no manual steps.
- Configuration Options: Users can provide custom configuration for the transpilation process via k6's existing configuration files or command-line options, allowing flexibility in how TypeScript is handled (e.g., specifying custom tsconfig.json settings).
Already existing or connected issues / PRs (optional)
No response