$ show grafana-cold-storage/postman-to-k6
This repository is a Node.js CLI tool that converts Postman collections into executable k6 JavaScript scripts for load testing. It reads Postman collection JSON (v1/v2) along with optional environment, globals, and data files, processes authentication methods, variables, pre-request/test scripts, and outputs a k6-compatible script. The architecture features distinct layers: input conversion (lib/convert), collection traversal and processing (lib/generate, lib/common), authentication strategies (lib/auth), and script rendering (lib/render). A shim layer (lib/shim) provides Postman API compatibility in the k6 environment using symbol-based state management and extension patterns. Despite the code demonstrating solid engineering practices, the project is explicitly unmaintained per its README, with development moved to a fork, and relies on outdated Node.js 11 in its Dockerfile.
The LLM identified 3 files worth highlighting for reuse:
Uses symbol-based state management (Initial, Iteration, Request, Var) to encapsulate internal state without polluting the global scope. This pattern enables safe communication between shim modules in the k6 VM and demonstrates advanced JavaScript techniques for state isolation.
Implements the authentication strategy pattern where each auth type (basic, bearer, oauth1, etc.) is a self-contained class with a consistent interface. This isolates authentication logic, making it easy to extend or modify without affecting core conversion logic.
Shows an extension pattern where shim modules check for `postman[Extend]` to allow external libraries to augment functionality. This enables a plugin-like architecture for adding custom libraries (like Chai) to the Postman sandbox in k6 without modifying core shim code.