@bitclaw/loadtest 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.
- package/LICENSE +21 -0
- package/README.md +112 -0
- package/dist/__fixtures__/configs.d.ts +8 -0
- package/dist/__fixtures__/configs.d.ts.map +1 -0
- package/dist/__fixtures__/configs.js +75 -0
- package/dist/__fixtures__/results.d.ts +13 -0
- package/dist/__fixtures__/results.d.ts.map +1 -0
- package/dist/__fixtures__/results.js +121 -0
- package/dist/auth/session.d.ts +18 -0
- package/dist/auth/session.d.ts.map +1 -0
- package/dist/auth/session.js +58 -0
- package/dist/cli/commands/report.d.ts +6 -0
- package/dist/cli/commands/report.d.ts.map +1 -0
- package/dist/cli/commands/report.js +46 -0
- package/dist/cli/commands/run.d.ts +6 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +97 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +12 -0
- package/dist/config/defaults.d.ts +77 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +60 -0
- package/dist/config/loader.d.ts +14 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +56 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/reports/formatter.d.ts +18 -0
- package/dist/reports/formatter.d.ts.map +1 -0
- package/dist/reports/formatter.js +99 -0
- package/dist/runner/bun-runner.d.ts +21 -0
- package/dist/runner/bun-runner.d.ts.map +1 -0
- package/dist/runner/bun-runner.js +140 -0
- package/dist/runner/k6-runner.d.ts +12 -0
- package/dist/runner/k6-runner.d.ts.map +1 -0
- package/dist/runner/k6-runner.js +80 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/package.json +44 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the @bitclaw/loadtest package.
|
|
3
|
+
*
|
|
4
|
+
* Builds on EndpointConfig from load-test-utils.ts and adds
|
|
5
|
+
* authentication, per-app configuration, and threshold support.
|
|
6
|
+
*/
|
|
7
|
+
import type { EndpointConfig, LoadTestResults, ScenarioResult } from '@bitclaw/sqlite/load-test-utils';
|
|
8
|
+
export type { EndpointConfig, LoadTestResults, ScenarioResult };
|
|
9
|
+
export type AuthConfig = {
|
|
10
|
+
/** Dedicated login endpoint path (e.g., "/api/loadtest/auth") */
|
|
11
|
+
loginEndpoint: string;
|
|
12
|
+
/** Env var name for the test user email */
|
|
13
|
+
emailEnvVar: string;
|
|
14
|
+
/** Env var name for the test user password */
|
|
15
|
+
passwordEnvVar: string;
|
|
16
|
+
/** Cookie name that holds the session (e.g., "runmist_session") */
|
|
17
|
+
sessionCookieName: string;
|
|
18
|
+
/** Direct credentials (used by RunMist dashboard, bypasses env vars) */
|
|
19
|
+
credentials?: {
|
|
20
|
+
email: string;
|
|
21
|
+
password: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type SessionState = {
|
|
25
|
+
cookies: string;
|
|
26
|
+
authenticated: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type ModeConfig = {
|
|
29
|
+
/** Concurrency levels to sweep through */
|
|
30
|
+
concurrencyLevels: number[];
|
|
31
|
+
/** Duration per scenario in seconds */
|
|
32
|
+
durationSec: number;
|
|
33
|
+
/** Warm-up requests before timing begins */
|
|
34
|
+
warmupRequests: number;
|
|
35
|
+
};
|
|
36
|
+
export type ThresholdConfig = {
|
|
37
|
+
/** Maximum acceptable P95 latency in ms */
|
|
38
|
+
p95MaxMs: number;
|
|
39
|
+
/** Minimum acceptable success rate (0-100) */
|
|
40
|
+
minSuccessRate: number;
|
|
41
|
+
/** Minimum req/s at lowest concurrency level */
|
|
42
|
+
minThroughput: number;
|
|
43
|
+
/** Per-Hetzner-tier threshold overrides */
|
|
44
|
+
tiers?: Record<string, Omit<ThresholdConfig, 'tiers'>>;
|
|
45
|
+
};
|
|
46
|
+
export type AppLoadTestConfig = {
|
|
47
|
+
/** App name (matches workspace directory, e.g., "runmist") */
|
|
48
|
+
appName: string;
|
|
49
|
+
/** Local base URL (e.g., "http://localhost:3001") */
|
|
50
|
+
baseUrl: string;
|
|
51
|
+
/** Production URL (e.g., "https://runmist.com") */
|
|
52
|
+
productionUrl?: string;
|
|
53
|
+
/** Direct origin URL for CDN bypass comparison (e.g., "http://87.99.x.x:3001") */
|
|
54
|
+
directUrl?: string;
|
|
55
|
+
/** Auth configuration (omit for public-only apps) */
|
|
56
|
+
auth?: AuthConfig;
|
|
57
|
+
/** Endpoints that don't require authentication */
|
|
58
|
+
publicEndpoints: EndpointConfig[];
|
|
59
|
+
/** Endpoints that require a valid session */
|
|
60
|
+
authenticatedEndpoints: EndpointConfig[];
|
|
61
|
+
/** Test mode configurations */
|
|
62
|
+
modes: {
|
|
63
|
+
quick: ModeConfig;
|
|
64
|
+
full: ModeConfig;
|
|
65
|
+
stress: ModeConfig;
|
|
66
|
+
};
|
|
67
|
+
/** Pass/fail thresholds */
|
|
68
|
+
thresholds: ThresholdConfig;
|
|
69
|
+
};
|
|
70
|
+
export type TestMode = 'quick' | 'full' | 'stress';
|
|
71
|
+
export type Engine = 'bun' | 'k6';
|
|
72
|
+
export type RunOptions = {
|
|
73
|
+
app: string;
|
|
74
|
+
mode: TestMode;
|
|
75
|
+
engine: Engine;
|
|
76
|
+
production: boolean;
|
|
77
|
+
publicOnly: boolean;
|
|
78
|
+
json: boolean;
|
|
79
|
+
tier?: string;
|
|
80
|
+
};
|
|
81
|
+
export type K6RunOptions = {
|
|
82
|
+
baseUrl: string;
|
|
83
|
+
email?: string;
|
|
84
|
+
password?: string;
|
|
85
|
+
jsonOutput?: string;
|
|
86
|
+
};
|
|
87
|
+
export type ThresholdResult = {
|
|
88
|
+
passed: boolean;
|
|
89
|
+
violations: ThresholdViolation[];
|
|
90
|
+
};
|
|
91
|
+
export type ThresholdViolation = {
|
|
92
|
+
scenario: string;
|
|
93
|
+
metric: string;
|
|
94
|
+
actual: number;
|
|
95
|
+
threshold: number;
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACf,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAMhE,MAAM,MAAM,UAAU,GAAG;IACvB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,WAAW,CAAC,EAAE;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAMF,MAAM,MAAM,UAAU,GAAG;IACvB,0CAA0C;IAC1C,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF,MAAM,MAAM,eAAe,GAAG;IAC5B,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,cAAc,EAAE,MAAM,CAAC;IACvB,gDAAgD;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,KAA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MF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,kBAAkB,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
package/dist/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bitclaw/loadtest",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Load testing framework for SQLite-backed web applications",
|
|
5
|
+
"files": ["dist", "LICENSE", "README.md"],
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" }
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"loadtest": "./dist/cli.js"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p tsconfig.build.json",
|
|
17
|
+
"test": "bun test",
|
|
18
|
+
"test:watch": "bun test --watch",
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"lint": "biome check",
|
|
21
|
+
"lint:fix": "biome check --write",
|
|
22
|
+
"format": "biome format --write",
|
|
23
|
+
"knip": "knip",
|
|
24
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
25
|
+
"publish:dev": "npm run build && npm publish --tag dev --access public",
|
|
26
|
+
"publish:patch": "npm whoami && npm version patch && git push --follow-tags && npm publish --access public",
|
|
27
|
+
"publish:minor": "npm whoami && npm version minor && git push --follow-tags && npm publish --access public",
|
|
28
|
+
"publish:major": "npm whoami && npm version major && git push --follow-tags && npm publish --access public"
|
|
29
|
+
},
|
|
30
|
+
"keywords": ["loadtest", "benchmark", "sqlite", "bun", "k6"],
|
|
31
|
+
"author": "bitclaw",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@bitclaw/sqlite": "^1.1.0",
|
|
35
|
+
"commander": "^12.1.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@biomejs/biome": "^2.4.15",
|
|
39
|
+
"knip": "^6.12.1",
|
|
40
|
+
"@types/bun": "^1.3.9",
|
|
41
|
+
"@types/node": "^22.0.0",
|
|
42
|
+
"typescript": "^5.8.3"
|
|
43
|
+
}
|
|
44
|
+
}
|