@elench/testkit 0.1.73 → 0.1.75

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.
@@ -286,8 +286,8 @@ export function nextApp(options = {}) {
286
286
  readyTimeoutMs,
287
287
  env: mode === "start"
288
288
  ? {
289
- NEXT_DIST_DIR: env.NEXT_DIST_DIR || "{prepareDir}/dist",
290
- NEXT_TSCONFIG_PATH: env.NEXT_TSCONFIG_PATH || "{prepareDir}/tsconfig.json",
289
+ NEXT_DIST_DIR: env.NEXT_DIST_DIR || ".next-testkit/{runtimeId}/dist",
290
+ NEXT_TSCONFIG_PATH: env.NEXT_TSCONFIG_PATH || ".next-testkit/{runtimeId}/tsconfig.json",
291
291
  ...env,
292
292
  }
293
293
  : env,
@@ -50,8 +50,8 @@ describe("config helpers", () => {
50
50
 
51
51
  expect(config.local.start).toBe("./node_modules/.bin/next start --port {port}");
52
52
  expect(config.local.env).toMatchObject({
53
- NEXT_DIST_DIR: "{prepareDir}/dist",
54
- NEXT_TSCONFIG_PATH: "{prepareDir}/tsconfig.json",
53
+ NEXT_DIST_DIR: ".next-testkit/{runtimeId}/dist",
54
+ NEXT_TSCONFIG_PATH: ".next-testkit/{runtimeId}/tsconfig.json",
55
55
  });
56
56
  expect(config.runtime.build).toEqual({
57
57
  kind: "next",
@@ -67,8 +67,8 @@ describe("config helpers", () => {
67
67
 
68
68
  expect(config.runtime.build).toBeNull();
69
69
  expect(config.local.env).toMatchObject({
70
- NEXT_DIST_DIR: "{prepareDir}/dist",
71
- NEXT_TSCONFIG_PATH: "{prepareDir}/tsconfig.json",
70
+ NEXT_DIST_DIR: ".next-testkit/{runtimeId}/dist",
71
+ NEXT_TSCONFIG_PATH: ".next-testkit/{runtimeId}/tsconfig.json",
72
72
  });
73
73
  });
74
74
 
@@ -3,12 +3,13 @@ import path from "path";
3
3
 
4
4
  export async function writeNextRuntimeTsconfig(context = {}) {
5
5
  const serviceDir = context.cwd || context.productDir;
6
- const prepareDir = context.prepareDir;
7
- if (!serviceDir || !prepareDir) {
8
- throw new Error("writeNextRuntimeTsconfig requires cwd and prepareDir");
6
+ const runtimeId = context.runtimeId;
7
+ if (!serviceDir || !runtimeId) {
8
+ throw new Error("writeNextRuntimeTsconfig requires cwd and runtimeId");
9
9
  }
10
10
 
11
- const outputPath = path.join(prepareDir, "tsconfig.json");
11
+ const runtimeRoot = path.join(serviceDir, ".next-testkit", String(runtimeId));
12
+ const outputPath = path.join(runtimeRoot, "tsconfig.json");
12
13
  const outputDir = path.dirname(outputPath);
13
14
  const relative = (target) => path.relative(outputDir, target).replaceAll(path.sep, "/");
14
15
  const srcDir = path.join(serviceDir, "src");
@@ -26,8 +27,8 @@ export async function writeNextRuntimeTsconfig(context = {}) {
26
27
  `${relative(srcDir)}/**/*.ts`,
27
28
  `${relative(srcDir)}/**/*.tsx`,
28
29
  `${relative(srcDir)}/**/*.mts`,
29
- `${relative(path.join(prepareDir, "dist", "types"))}/**/*.ts`,
30
- `${relative(path.join(prepareDir, "dist", "dev", "types"))}/**/*.ts`,
30
+ "dist/types/**/*.ts",
31
+ "dist/dev/types/**/*.ts",
31
32
  ],
32
33
  exclude: [
33
34
  "node_modules",
@@ -18,37 +18,38 @@ describe("next runtime tsconfig helper", () => {
18
18
  cleanups.push(() => fs.rmSync(tempRoot, { recursive: true, force: true }));
19
19
 
20
20
  const serviceDir = path.join(tempRoot, "frontend");
21
- const prepareDir = path.join(tempRoot, ".testkit", "prepared");
22
21
  fs.mkdirSync(path.join(serviceDir, "src"), { recursive: true });
23
22
  fs.writeFileSync(path.join(serviceDir, "tsconfig.json"), "{}\n");
24
23
  fs.writeFileSync(path.join(serviceDir, "next-env.d.ts"), "// next\n");
25
24
 
26
25
  await writeNextRuntimeTsconfig({
27
26
  cwd: serviceDir,
28
- prepareDir,
29
27
  productDir: tempRoot,
28
+ runtimeId: "runtime-1",
30
29
  });
31
30
 
32
- const generated = JSON.parse(fs.readFileSync(path.join(prepareDir, "tsconfig.json"), "utf8"));
31
+ const generated = JSON.parse(
32
+ fs.readFileSync(path.join(serviceDir, ".next-testkit", "runtime-1", "tsconfig.json"), "utf8")
33
+ );
33
34
  expect(generated).toEqual({
34
- extends: "../../frontend/tsconfig.json",
35
+ extends: "../../tsconfig.json",
35
36
  compilerOptions: {
36
37
  paths: {
37
- "@/*": ["../../frontend/src/*"],
38
+ "@/*": ["../../src/*"],
38
39
  },
39
40
  },
40
41
  include: [
41
- "../../frontend/next-env.d.ts",
42
- "../../frontend/src/**/*.ts",
43
- "../../frontend/src/**/*.tsx",
44
- "../../frontend/src/**/*.mts",
42
+ "../../next-env.d.ts",
43
+ "../../src/**/*.ts",
44
+ "../../src/**/*.tsx",
45
+ "../../src/**/*.mts",
45
46
  "dist/types/**/*.ts",
46
47
  "dist/dev/types/**/*.ts",
47
48
  ],
48
49
  exclude: [
49
50
  "node_modules",
50
- "../../frontend/src/**/__testkit__/**",
51
- "../../frontend/tests/**",
51
+ "../../src/**/__testkit__/**",
52
+ "../../tests/**",
52
53
  ".next/cache",
53
54
  ".next/dev",
54
55
  ],
@@ -214,6 +214,7 @@ function buildExecutionEnvWithContext(config, lease, extraEnv, processEnv) {
214
214
  const env = {
215
215
  ...inheritedEnv,
216
216
  ...resolveEnvTemplates(config.testkit.serviceEnv || {}, templateContext),
217
+ ...resolveEnvTemplates(config.testkit.local?.env || {}, templateContext),
217
218
  ...resolveEnvTemplates(extraEnv, templateContext),
218
219
  TESTKIT_ACTIVE: "1",
219
220
  ...(config.runtimeId ? { TESTKIT_RUNTIME_ID: String(config.runtimeId) } : {}),
@@ -164,10 +164,7 @@ describe("runner-template", () => {
164
164
  expect(
165
165
  buildExecutionEnv(
166
166
  resolved[1],
167
- {
168
- ...resolved[1].testkit.local.env,
169
- DATABASE_URL: "gone",
170
- },
167
+ { DATABASE_URL: "gone" },
171
168
  {
172
169
  PATH: "/usr/bin",
173
170
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/next-analysis",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "description": "SWC-backed Next.js source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-bridge",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "description": "Browser bridge helpers for testkit",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "typecheck": "tsc -p tsconfig.json --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@elench/testkit-protocol": "0.1.73"
25
+ "@elench/testkit-protocol": "0.1.75"
26
26
  },
27
27
  "private": false
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-protocol",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "description": "Shared browser protocol for testkit bridge and extension consumers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/ts-analysis",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "description": "TypeScript compiler-backed source analysis primitives for Erench tools",
5
5
  "type": "module",
6
6
  "exports": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "description": "CLI for discovering and running local HTTP, DAL, and Playwright test suites",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -75,16 +75,16 @@
75
75
  "@elench/testkit-protocol"
76
76
  ],
77
77
  "devDependencies": {
78
- "@types/node": "^24.9.1",
79
78
  "@playwright/test": "^1.52.0",
79
+ "@types/node": "^24.9.1",
80
80
  "vitest": "^3.2.4"
81
81
  },
82
82
  "dependencies": {
83
- "@elench/next-analysis": "0.1.73",
84
- "@elench/ts-analysis": "0.1.73",
85
- "@elench/testkit-bridge": "0.1.73",
86
- "@elench/testkit-protocol": "0.1.73",
87
83
  "@babel/code-frame": "^7.29.0",
84
+ "@elench/next-analysis": "0.1.75",
85
+ "@elench/testkit-bridge": "0.1.75",
86
+ "@elench/testkit-protocol": "0.1.75",
87
+ "@elench/ts-analysis": "0.1.75",
88
88
  "@oclif/core": "^4.10.6",
89
89
  "esbuild": "^0.25.11",
90
90
  "execa": "^9.5.0",