Skip to content

Commit 689e65d

Browse files
committed
fix(create-gen-app-test): move integration-helpers to fix TypeScript rootDir error
Move integration-helpers.ts from create-gen-app/test-utils to create-gen-app-test/src/test-utils to resolve TS6059 error where files outside rootDir cannot be imported during build. Changes: - Copy integration-helpers.ts to create-gen-app-test/src/test-utils/ - Update cli.test.ts import path to use local test-utils - Update cached-template.test.ts.snap to reflect latest template structure This ensures all source files are within the package's rootDir boundary, fixing the CI build error: "File is not under 'rootDir'".
1 parent 6d5f895 commit 689e65d

File tree

3 files changed

+70
-23
lines changed

3 files changed

+70
-23
lines changed

packages/create-gen-app-test/src/__tests__/__snapshots__/cached-template.test.ts.snap

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,30 @@ exports[`cached template integration tests first clone with variable replacement
3333
exports[`cached template integration tests first clone with variable replacement should snapshot package.json files if they exist 1`] = `
3434
{
3535
"module/package.json": {
36-
"author": "__USERFULLNAME__ <__USEREMAIL__>",
36+
"author": "____fullName____ <____email____>",
3737
"bugs": {
38-
"url": "https://github.com/__USERNAME__/__REPONAME__/issues",
38+
"url": "https://github.com/____username____/____repoName____/issues",
3939
},
40-
"description": "__MODULEDESC__",
40+
"description": "____moduleDesc____",
4141
"devDependencies": {
4242
"pgsql-test": "^2.13.2",
4343
},
44-
"homepage": "https://github.com/__USERNAME__/__REPONAME__",
44+
"homepage": "https://github.com/____username____/____repoName____",
4545
"keywords": [],
46-
"license": "SEE LICENSE IN LICENSE",
47-
"name": "__PACKAGE_IDENTIFIER__",
46+
"license": "____license____",
47+
"name": "____packageIdentifier____",
4848
"pnpm": {
4949
"overrides": {
5050
"graphql": "14.7.0",
5151
},
5252
},
5353
"publishConfig": {
54-
"access": "__ACCESS__",
54+
"access": "____access____",
5555
"directory": "dist",
5656
},
5757
"repository": {
5858
"type": "git",
59-
"url": "https://github.com/__USERNAME__/__REPONAME__",
59+
"url": "https://github.com/____username____/____repoName____",
6060
},
6161
"scripts": {
6262
"lint": "eslint . --fix",
@@ -66,7 +66,7 @@ exports[`cached template integration tests first clone with variable replacement
6666
"version": "0.0.1",
6767
},
6868
"workspace/package.json": {
69-
"author": "__USERFULLNAME__ <__USEREMAIL__>",
69+
"author": "____fullName____ <____email____>",
7070
"devDependencies": {
7171
"@types/jest": "^29.5.14",
7272
"@types/node": "^22.10.2",
@@ -85,7 +85,7 @@ exports[`cached template integration tests first clone with variable replacement
8585
"typescript": "^5.6.3",
8686
},
8787
"license": "SEE LICENSE IN LICENSE",
88-
"name": "__MODULENAME__",
88+
"name": "____moduleName____",
8989
"pnpm": {
9090
"overrides": {
9191
"graphql": "14.7.0",
@@ -97,7 +97,7 @@ exports[`cached template integration tests first clone with variable replacement
9797
},
9898
"repository": {
9999
"type": "git",
100-
"url": "https://github.com/__USERNAME__/__MODULENAME__",
100+
"url": "https://github.com/____username____/____moduleName____",
101101
},
102102
"scripts": {
103103
"lint": "pnpm -r run lint",
@@ -143,30 +143,30 @@ exports[`cached template integration tests second clone from cache should snapsh
143143
exports[`cached template integration tests second clone from cache should snapshot package.json files from cached template 1`] = `
144144
{
145145
"module/package.json": {
146-
"author": "__USERFULLNAME__ <__USEREMAIL__>",
146+
"author": "____fullName____ <____email____>",
147147
"bugs": {
148-
"url": "https://github.com/__USERNAME__/__REPONAME__/issues",
148+
"url": "https://github.com/____username____/____repoName____/issues",
149149
},
150-
"description": "__MODULEDESC__",
150+
"description": "____moduleDesc____",
151151
"devDependencies": {
152152
"pgsql-test": "^2.13.2",
153153
},
154-
"homepage": "https://github.com/__USERNAME__/__REPONAME__",
154+
"homepage": "https://github.com/____username____/____repoName____",
155155
"keywords": [],
156-
"license": "SEE LICENSE IN LICENSE",
157-
"name": "__PACKAGE_IDENTIFIER__",
156+
"license": "____license____",
157+
"name": "____packageIdentifier____",
158158
"pnpm": {
159159
"overrides": {
160160
"graphql": "14.7.0",
161161
},
162162
},
163163
"publishConfig": {
164-
"access": "__ACCESS__",
164+
"access": "____access____",
165165
"directory": "dist",
166166
},
167167
"repository": {
168168
"type": "git",
169-
"url": "https://github.com/__USERNAME__/__REPONAME__",
169+
"url": "https://github.com/____username____/____repoName____",
170170
},
171171
"scripts": {
172172
"lint": "eslint . --fix",
@@ -176,7 +176,7 @@ exports[`cached template integration tests second clone from cache should snapsh
176176
"version": "0.0.1",
177177
},
178178
"workspace/package.json": {
179-
"author": "__USERFULLNAME__ <__USEREMAIL__>",
179+
"author": "____fullName____ <____email____>",
180180
"devDependencies": {
181181
"@types/jest": "^29.5.14",
182182
"@types/node": "^22.10.2",
@@ -195,7 +195,7 @@ exports[`cached template integration tests second clone from cache should snapsh
195195
"typescript": "^5.6.3",
196196
},
197197
"license": "SEE LICENSE IN LICENSE",
198-
"name": "__MODULENAME__",
198+
"name": "____moduleName____",
199199
"pnpm": {
200200
"overrides": {
201201
"graphql": "14.7.0",
@@ -207,7 +207,7 @@ exports[`cached template integration tests second clone from cache should snapsh
207207
},
208208
"repository": {
209209
"type": "git",
210-
"url": "https://github.com/__USERNAME__/__MODULENAME__",
210+
"url": "https://github.com/____username____/____moduleName____",
211211
},
212212
"scripts": {
213213
"lint": "pnpm -r run lint",

packages/create-gen-app-test/src/__tests__/cli.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
buildAnswers,
1010
cleanupWorkspace,
1111
createTempWorkspace,
12-
} from "../../../create-gen-app/test-utils/integration-helpers";
12+
} from "../test-utils/integration-helpers";
1313

1414
jest.setTimeout(180_000);
1515

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import * as fs from "fs";
2+
import * as os from "os";
3+
import * as path from "path";
4+
5+
export const TEST_REPO =
6+
process.env.CREATE_GEN_TEST_REPO ??
7+
"https://github.com/launchql/pgpm-boilerplates.git";
8+
export const TEST_BRANCH =
9+
process.env.CREATE_GEN_TEST_BRANCH ?? "license";
10+
export const TEST_TEMPLATE =
11+
process.env.CREATE_GEN_TEST_TEMPLATE ?? "module";
12+
13+
export interface TempWorkspace {
14+
baseDir: string;
15+
outputDir: string;
16+
}
17+
18+
export function createTempWorkspace(prefix: string): TempWorkspace {
19+
const baseDir = fs.mkdtempSync(path.join(os.tmpdir(), `create-gen-${prefix}-`));
20+
const outputDir = path.join(baseDir, "output");
21+
return { baseDir, outputDir };
22+
}
23+
24+
export function cleanupWorkspace(workspace: TempWorkspace): void {
25+
fs.rmSync(workspace.baseDir, { recursive: true, force: true });
26+
}
27+
28+
export function buildAnswers(
29+
suffix: string,
30+
overrides: Partial<Record<string, string>> = {}
31+
): Record<string, string> {
32+
const safeSuffix = suffix.replace(/[^a-z0-9]/gi, "-").toLowerCase();
33+
return {
34+
USERFULLNAME: `Test User ${suffix}`,
35+
USEREMAIL: `tester-${safeSuffix}@example.com`,
36+
MODULENAME: `Test Module ${suffix}`,
37+
MODULEDESC: `Integration test module ${suffix}`,
38+
REPONAME: `integration-${safeSuffix}`,
39+
USERNAME: `tester-${safeSuffix}`,
40+
ACCESS: "public",
41+
LICENSE: "MIT",
42+
PACKAGE_IDENTIFIER: `integration-${safeSuffix}`,
43+
...overrides,
44+
};
45+
}
46+
47+

0 commit comments

Comments
 (0)