k6-perf-reporter 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,7 +48,8 @@
48
48
  "Bash(git:*)",
49
49
  "Bash(npm audit:*)",
50
50
  "Bash(npm publish:*)",
51
- "Bash(npm login:*)"
51
+ "Bash(npm login:*)",
52
+ "Bash(k6-reporter:*)"
52
53
  ]
53
54
  }
54
55
  }
package/dist/cli.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ #!/usr/bin/env node
1
2
  export {};
2
3
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const commander_1 = require("commander");
@@ -37,6 +38,76 @@ function main() {
37
38
  process.exit(1);
38
39
  }
39
40
  });
41
+ commander_1.program
42
+ .command("help")
43
+ .description("Show help and examples")
44
+ .action(() => {
45
+ console.log(`
46
+ k6-reporter - Generate CLI reports from k6 tests stored in InfluxDB
47
+
48
+ USAGE:
49
+ k6-reporter <command> [options]
50
+
51
+ COMMANDS:
52
+ generate Generate performance test report
53
+ help Show this help message
54
+
55
+ GENERATE COMMAND:
56
+ k6-reporter generate --run-id <id> [options]
57
+
58
+ OPTIONS:
59
+ --run-id <id> k6 test run ID (required)
60
+ -st, --start-time Start time (relative: -1h, -30m, or ISO 8601)
61
+ -et, --end-time End time (ISO 8601 format, defaults to now)
62
+ -c, --config Path to config file (default: .config.json)
63
+ -f, --format Output format: 'json' or 'cli' (default: cli)
64
+ -o, --output Output file path (for json format)
65
+ -h, --help Show command help
66
+ -V, --version Show version
67
+
68
+ EXAMPLES:
69
+
70
+ 1. Generate CLI report for the last hour:
71
+ k6-reporter generate --run-id 123456790121 -st -1h
72
+
73
+ 2. Generate report for specific time range:
74
+ k6-reporter generate --run-id 123456790121 -st -3h -et -1h
75
+
76
+ 3. Export as JSON:
77
+ k6-reporter generate --run-id 123456790121 --format json
78
+
79
+ 4. Save JSON report to file:
80
+ k6-reporter generate --run-id 123456790121 --format json -o report.json
81
+
82
+ 5. Use custom config file:
83
+ k6-reporter generate --run-id 123456790121 -c /path/to/config.json
84
+
85
+ 6. Get help for generate command:
86
+ k6-reporter generate --help
87
+
88
+ TIME FORMAT:
89
+
90
+ Relative times (from now):
91
+ -1h Last hour
92
+ -30m Last 30 minutes
93
+ -1d Last day
94
+
95
+ ISO 8601 format:
96
+ 2024-04-08T12:00:00Z
97
+ 2024-04-08T12:00:00+02:00
98
+
99
+ CONFIG FILE:
100
+
101
+ The config file (.config.json) should contain InfluxDB connection settings:
102
+
103
+ {
104
+ "influxUrl": "https://influxdb.example.com",
105
+ "influxToken": "your-influx-token",
106
+ "influxOrg": "your-org",
107
+ "influxBucket": "your-bucket"
108
+ }
109
+ `);
110
+ });
40
111
  commander_1.program.parse();
41
112
  }
42
113
  main();
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAAA,yCAAoC;AACpC,qCAAkC;AAClC,qDAAiD;AACjD,2CAAwD;AAExD,SAAS,IAAI;IACX,mBAAO;SACJ,IAAI,CAAC,aAAa,CAAC;SACnB,WAAW,CAAC,uDAAuD,CAAC;SACpE,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,mBAAO;SACJ,OAAO,CAAC,UAAU,CAAC;SACnB,WAAW,CAAC,kCAAkC,CAAC;SAC/C,cAAc,CAAC,eAAe,EAAE,gBAAgB,CAAC;SACjD,MAAM,CAAC,0BAA0B,EAAE,sDAAsD,CAAC;SAC1F,MAAM,CAAC,wBAAwB,EAAE,+CAA+C,CAAC;SACjF,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,EAAE,cAAc,CAAC;SACpE,MAAM,CAAC,uBAAuB,EAAE,gCAAgC,EAAE,KAAK,CAAC;SACxE,MAAM,CAAC,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,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,mBAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,GAAG,EAAE;QACX,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgEX,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,mBAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAED,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "k6-perf-reporter",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Reporting tool for k6 performance tests with InfluxDB 2 integration",
5
5
  "main": "dist/index.js",
6
+ "bin": {
7
+ "k6-reporter": "dist/cli.js"
8
+ },
6
9
  "scripts": {
7
10
  "dev": "tsx src/index.ts",
8
11
  "build": "tsc",
package/src/cli.ts CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  import { program } from "commander";
2
4
  import { Config } from "./config";
3
5
  import { DataCollector } from "./data-collector";
@@ -41,6 +43,77 @@ function main(): void {
41
43
  }
42
44
  });
43
45
 
46
+ program
47
+ .command("help")
48
+ .description("Show help and examples")
49
+ .action(() => {
50
+ console.log(`
51
+ k6-reporter - Generate CLI reports from k6 tests stored in InfluxDB
52
+
53
+ USAGE:
54
+ k6-reporter <command> [options]
55
+
56
+ COMMANDS:
57
+ generate Generate performance test report
58
+ help Show this help message
59
+
60
+ GENERATE COMMAND:
61
+ k6-reporter generate --run-id <id> [options]
62
+
63
+ OPTIONS:
64
+ --run-id <id> k6 test run ID (required)
65
+ -st, --start-time Start time (relative: -1h, -30m, or ISO 8601)
66
+ -et, --end-time End time (ISO 8601 format, defaults to now)
67
+ -c, --config Path to config file (default: .config.json)
68
+ -f, --format Output format: 'json' or 'cli' (default: cli)
69
+ -o, --output Output file path (for json format)
70
+ -h, --help Show command help
71
+ -V, --version Show version
72
+
73
+ EXAMPLES:
74
+
75
+ 1. Generate CLI report for the last hour:
76
+ k6-reporter generate --run-id 123456790121 -st -1h
77
+
78
+ 2. Generate report for specific time range:
79
+ k6-reporter generate --run-id 123456790121 -st -3h -et -1h
80
+
81
+ 3. Export as JSON:
82
+ k6-reporter generate --run-id 123456790121 --format json
83
+
84
+ 4. Save JSON report to file:
85
+ k6-reporter generate --run-id 123456790121 --format json -o report.json
86
+
87
+ 5. Use custom config file:
88
+ k6-reporter generate --run-id 123456790121 -c /path/to/config.json
89
+
90
+ 6. Get help for generate command:
91
+ k6-reporter generate --help
92
+
93
+ TIME FORMAT:
94
+
95
+ Relative times (from now):
96
+ -1h Last hour
97
+ -30m Last 30 minutes
98
+ -1d Last day
99
+
100
+ ISO 8601 format:
101
+ 2024-04-08T12:00:00Z
102
+ 2024-04-08T12:00:00+02:00
103
+
104
+ CONFIG FILE:
105
+
106
+ The config file (.config.json) should contain InfluxDB connection settings:
107
+
108
+ {
109
+ "influxUrl": "https://influxdb.example.com",
110
+ "influxToken": "your-influx-token",
111
+ "influxOrg": "your-org",
112
+ "influxBucket": "your-bucket"
113
+ }
114
+ `);
115
+ });
116
+
44
117
  program.parse();
45
118
  }
46
119