@elench/testkit 0.1.4 → 0.1.5

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/README.md CHANGED
@@ -51,7 +51,8 @@ npx @elench/testkit destroy
51
51
  2. **Neon** — discovers or creates a `<service>-test` branch, truncates tables between runs
52
52
  3. **Fly** — discovers or creates a machine on the service's test app, updates env vars
53
53
  4. **k6** — runs matched test files with `BASE_URL` and `MACHINE_ID` injected
54
- 5. **Cleanup** — stops the Fly machine (preserved for next run)
54
+ 5. **DAL** — DAL tests use a bundled k6-sql binary (`vendor/k6`) no external binary needed
55
+ 6. **Cleanup** — stops the Fly machine (preserved for next run)
55
56
 
56
57
  Multi-service products run all services in parallel. Each service gets its own Neon branch and Fly machine.
57
58
 
package/lib/config.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
+ import { fileURLToPath } from "url";
3
4
 
4
5
  /**
5
6
  * Parse a .env file into an object. Supports KEY=VALUE, KEY='VALUE', KEY="VALUE".
@@ -113,17 +114,13 @@ export function requireFlyToken(serviceName) {
113
114
  }
114
115
 
115
116
  /**
116
- * Resolve the custom k6 binary for DAL tests. Returns the absolute path.
117
+ * Resolve the bundled k6-sql binary for DAL tests. Returns the absolute path.
117
118
  */
118
- export function resolveDalBinary(config) {
119
- const { productDir, manifest } = config;
120
- const rel = manifest.testkit.dal?.k6Binary;
121
- if (!rel) {
122
- throw new Error("testkit.dal.k6Binary is required for DAL tests");
123
- }
124
- const abs = path.resolve(productDir, rel);
119
+ export function resolveDalBinary() {
120
+ const thisFile = fileURLToPath(import.meta.url);
121
+ const abs = path.resolve(path.dirname(thisFile), "..", "vendor", "k6");
125
122
  if (!fs.existsSync(abs)) {
126
- throw new Error(`DAL k6 binary not found: ${abs}`);
123
+ throw new Error(`Bundled DAL k6 binary not found: ${abs}`);
127
124
  }
128
125
  return abs;
129
126
  }
@@ -185,16 +182,8 @@ function validateService(name, svc, manifestPath) {
185
182
  errors.push(`${ctx}: testkit.k6 must be an object`);
186
183
  }
187
184
 
188
- if (tk.dal !== undefined) {
189
- if (!isObject(tk.dal)) {
190
- errors.push(`${ctx}: testkit.dal must be an object`);
191
- } else if (svc.suites?.dal) {
192
- requireString(errors, tk.dal, `${ctx}: testkit.dal.k6Binary`, "k6Binary");
193
- }
194
- }
195
-
196
- if (svc.suites?.dal && !tk.dal) {
197
- errors.push(`${ctx}: testkit.dal is required when suites.dal exists`);
185
+ if (tk.dal !== undefined && !isObject(tk.dal)) {
186
+ errors.push(`${ctx}: testkit.dal must be an object`);
198
187
  }
199
188
  }
200
189
 
package/lib/runner.mjs CHANGED
@@ -156,7 +156,7 @@ export async function runTests(config, files) {
156
156
  export async function runDalTests(config, files) {
157
157
  const { productDir, stateDir, manifest } = config;
158
158
  const tk = manifest.testkit;
159
- const k6Binary = resolveDalBinary(config);
159
+ const k6Binary = resolveDalBinary();
160
160
 
161
161
  // Read DATABASE_URL from neon state
162
162
  const databaseUrl = fs.readFileSync(path.join(stateDir, "database_url"), "utf8").trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "CLI for running k6 tests against real, ephemeral infrastructure",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,8 @@
9
9
  "files": [
10
10
  "bin/",
11
11
  "lib/",
12
- "infra/"
12
+ "infra/",
13
+ "vendor/"
13
14
  ],
14
15
  "dependencies": {
15
16
  "cac": "^6.7.14",
package/vendor/k6 ADDED
Binary file