@elench/testkit 0.1.74 → 0.1.76

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
  ],
@@ -280,6 +280,7 @@ export function resolveTemplateString(value, context) {
280
280
  return value.replace(/\{([a-zA-Z]+)(?::([a-zA-Z0-9_-]+))?\}/g, (_match, token, arg) => {
281
281
  switch (token) {
282
282
  case "runtime":
283
+ case "runtimeId":
283
284
  return String(context.runtimeId);
284
285
  case "service":
285
286
  return context.serviceName;
@@ -192,6 +192,9 @@ describe("runner-template", () => {
192
192
  TESTKIT_LEASE_ID: "lease-1",
193
193
  TESTKIT_LEASE_DIR: "/tmp/lease-1",
194
194
  });
195
+ expect(finalizeString(".next-testkit/{runtimeId}/dist", resolved[1].testkit.templateContext)).toBe(
196
+ ".next-testkit/runtime-2/dist"
197
+ );
195
198
 
196
199
  expect(
197
200
  buildPlaywrightEnv(
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/next-analysis",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
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.74",
3
+ "version": "0.1.76",
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.74"
25
+ "@elench/testkit-protocol": "0.1.76"
26
26
  },
27
27
  "private": false
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elench/testkit-protocol",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
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.74",
3
+ "version": "0.1.76",
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.74",
3
+ "version": "0.1.76",
4
4
  "description": "CLI for discovering and running local HTTP, DAL, and Playwright test suites",
5
5
  "type": "module",
6
6
  "workspaces": [
@@ -81,10 +81,10 @@
81
81
  },
82
82
  "dependencies": {
83
83
  "@babel/code-frame": "^7.29.0",
84
- "@elench/next-analysis": "0.1.74",
85
- "@elench/testkit-bridge": "0.1.74",
86
- "@elench/testkit-protocol": "0.1.74",
87
- "@elench/ts-analysis": "0.1.74",
84
+ "@elench/next-analysis": "0.1.76",
85
+ "@elench/testkit-bridge": "0.1.76",
86
+ "@elench/testkit-protocol": "0.1.76",
87
+ "@elench/ts-analysis": "0.1.76",
88
88
  "@oclif/core": "^4.10.6",
89
89
  "esbuild": "^0.25.11",
90
90
  "execa": "^9.5.0",