create-next-imagicma 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/package.json
CHANGED
package/template-hono/README.md
CHANGED
|
@@ -57,23 +57,3 @@ pnpm db:push
|
|
|
57
57
|
|
|
58
58
|
- API:`GET /api/greeting`
|
|
59
59
|
- 页面:`/hello`
|
|
60
|
-
|
|
61
|
-
## E2E 与 `run_test`
|
|
62
|
-
|
|
63
|
-
- Playwright 配置位于 [`playwright.config.ts`](/Users/alexliu/Project/imagicma-all/imagicma-template/hono-app/playwright.config.ts)
|
|
64
|
-
- 测试契约位于 [`hono-app/.imagicma/testing-manifest.json`](/Users/alexliu/Project/imagicma-all/imagicma-template/hono-app/.imagicma/testing-manifest.json)
|
|
65
|
-
- 本地回归命令:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
pnpm test:e2e
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
- `run_test` 驱动 Playwright 时会注入:
|
|
72
|
-
- `IMAGICMA_RUN_ID`
|
|
73
|
-
- `IMAGICMA_RUN_TEST_RUNTIME_ROOT`
|
|
74
|
-
- `IMAGICMA_RUN_TEST_SKIP_WEBSERVER`
|
|
75
|
-
- `BASE_URL`
|
|
76
|
-
|
|
77
|
-
fixtures 约定:
|
|
78
|
-
- `tests/e2e/fixtures/imagicma.ts` 必须把浏览器 warning/error、page errors、失败网络请求与 current URL 写入 `IMAGICMA_RUN_TEST_RUNTIME_ROOT`
|
|
79
|
-
- `testing-manifest.json` 负责声明稳定页面、selectors、fixtures 与 auth profile,供 `run_test` 编译阶段使用
|
package/template-hono/gitignore
CHANGED
|
@@ -10,10 +10,7 @@
|
|
|
10
10
|
"start": "node ./scripts/imagicma-start.mjs",
|
|
11
11
|
"check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.server.json --noEmit",
|
|
12
12
|
"db:push": "drizzle-kit push",
|
|
13
|
-
"lint": "eslint ."
|
|
14
|
-
"test:e2e": "playwright test",
|
|
15
|
-
"test:e2e:ui": "playwright test --ui",
|
|
16
|
-
"test:e2e:headed": "playwright test --headed"
|
|
13
|
+
"lint": "eslint ."
|
|
17
14
|
},
|
|
18
15
|
"dependencies": {
|
|
19
16
|
"@libsql/client": "^0.17.0",
|
|
@@ -70,7 +67,6 @@
|
|
|
70
67
|
"zod": "^4.1.5"
|
|
71
68
|
},
|
|
72
69
|
"devDependencies": {
|
|
73
|
-
"@playwright/test": "^1.57.0",
|
|
74
70
|
"@hono/vite-dev-server": "^0.25.0",
|
|
75
71
|
"@tailwindcss/postcss": "^4",
|
|
76
72
|
"@types/node": "^20",
|
|
@@ -168,9 +168,6 @@ importers:
|
|
|
168
168
|
'@hono/vite-dev-server':
|
|
169
169
|
specifier: ^0.25.0
|
|
170
170
|
version: 0.25.0(hono@4.11.9)
|
|
171
|
-
'@playwright/test':
|
|
172
|
-
specifier: ^1.57.0
|
|
173
|
-
version: 1.58.2
|
|
174
171
|
'@tailwindcss/postcss':
|
|
175
172
|
specifier: ^4
|
|
176
173
|
version: 4.1.18
|
|
@@ -926,11 +923,6 @@ packages:
|
|
|
926
923
|
'@neon-rs/load@0.0.4':
|
|
927
924
|
resolution: {integrity: sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==}
|
|
928
925
|
|
|
929
|
-
'@playwright/test@1.58.2':
|
|
930
|
-
resolution: {integrity: sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==}
|
|
931
|
-
engines: {node: '>=18'}
|
|
932
|
-
hasBin: true
|
|
933
|
-
|
|
934
926
|
'@radix-ui/number@1.1.1':
|
|
935
927
|
resolution: {integrity: sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==}
|
|
936
928
|
|
|
@@ -2362,11 +2354,6 @@ packages:
|
|
|
2362
2354
|
fs-constants@1.0.0:
|
|
2363
2355
|
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
|
|
2364
2356
|
|
|
2365
|
-
fsevents@2.3.2:
|
|
2366
|
-
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
|
2367
|
-
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
|
2368
|
-
os: [darwin]
|
|
2369
|
-
|
|
2370
2357
|
fsevents@2.3.3:
|
|
2371
2358
|
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
|
|
2372
2359
|
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
|
@@ -2731,16 +2718,6 @@ packages:
|
|
|
2731
2718
|
resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==}
|
|
2732
2719
|
engines: {node: '>=12'}
|
|
2733
2720
|
|
|
2734
|
-
playwright-core@1.58.2:
|
|
2735
|
-
resolution: {integrity: sha512-yZkEtftgwS8CsfYo7nm0KE8jsvm6i/PTgVtB8DL726wNf6H2IMsDuxCpJj59KDaxCtSnrWan2AeDqM7JBaultg==}
|
|
2736
|
-
engines: {node: '>=18'}
|
|
2737
|
-
hasBin: true
|
|
2738
|
-
|
|
2739
|
-
playwright@1.58.2:
|
|
2740
|
-
resolution: {integrity: sha512-vA30H8Nvkq/cPBnNw4Q8TWz1EJyqgpuinBcHET0YVJVFldr8JDNiU9LaWAE1KqSkRYazuaBhTpB5ZzShOezQ6A==}
|
|
2741
|
-
engines: {node: '>=18'}
|
|
2742
|
-
hasBin: true
|
|
2743
|
-
|
|
2744
2721
|
postcss@8.5.6:
|
|
2745
2722
|
resolution: {integrity: sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==}
|
|
2746
2723
|
engines: {node: ^10 || ^12 || >=14}
|
|
@@ -3675,10 +3652,6 @@ snapshots:
|
|
|
3675
3652
|
|
|
3676
3653
|
'@neon-rs/load@0.0.4': {}
|
|
3677
3654
|
|
|
3678
|
-
'@playwright/test@1.58.2':
|
|
3679
|
-
dependencies:
|
|
3680
|
-
playwright: 1.58.2
|
|
3681
|
-
|
|
3682
3655
|
'@radix-ui/number@1.1.1': {}
|
|
3683
3656
|
|
|
3684
3657
|
'@radix-ui/primitive@1.1.3': {}
|
|
@@ -5073,9 +5046,6 @@ snapshots:
|
|
|
5073
5046
|
fs-constants@1.0.0:
|
|
5074
5047
|
optional: true
|
|
5075
5048
|
|
|
5076
|
-
fsevents@2.3.2:
|
|
5077
|
-
optional: true
|
|
5078
|
-
|
|
5079
5049
|
fsevents@2.3.3:
|
|
5080
5050
|
optional: true
|
|
5081
5051
|
|
|
@@ -5386,14 +5356,6 @@ snapshots:
|
|
|
5386
5356
|
|
|
5387
5357
|
picomatch@4.0.3: {}
|
|
5388
5358
|
|
|
5389
|
-
playwright-core@1.58.2: {}
|
|
5390
|
-
|
|
5391
|
-
playwright@1.58.2:
|
|
5392
|
-
dependencies:
|
|
5393
|
-
playwright-core: 1.58.2
|
|
5394
|
-
optionalDependencies:
|
|
5395
|
-
fsevents: 2.3.2
|
|
5396
|
-
|
|
5397
5359
|
postcss@8.5.6:
|
|
5398
5360
|
dependencies:
|
|
5399
5361
|
nanoid: 3.3.11
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "@playwright/test";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
const runtimeRoot = process.env.IMAGICMA_RUN_TEST_RUNTIME_ROOT;
|
|
5
|
-
const baseURL = process.env.BASE_URL || "http://127.0.0.1:5001";
|
|
6
|
-
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
testDir: "./tests/e2e",
|
|
9
|
-
fullyParallel: false,
|
|
10
|
-
workers: 1,
|
|
11
|
-
timeout: 60_000,
|
|
12
|
-
retries: 0,
|
|
13
|
-
outputDir: runtimeRoot ? join(runtimeRoot, "test-results") : "test-results",
|
|
14
|
-
reporter: runtimeRoot
|
|
15
|
-
? [
|
|
16
|
-
["line"],
|
|
17
|
-
["json", { outputFile: join(runtimeRoot, "playwright-results.json") }],
|
|
18
|
-
["html", { outputFolder: join(runtimeRoot, "html-report"), open: "never" }],
|
|
19
|
-
["junit", { outputFile: join(runtimeRoot, "junit.xml") }],
|
|
20
|
-
]
|
|
21
|
-
: [
|
|
22
|
-
["html", { outputFolder: "playwright-report", open: "never" }],
|
|
23
|
-
["list"],
|
|
24
|
-
],
|
|
25
|
-
use: {
|
|
26
|
-
baseURL,
|
|
27
|
-
trace: "retain-on-failure",
|
|
28
|
-
screenshot: "only-on-failure",
|
|
29
|
-
video: "retain-on-failure",
|
|
30
|
-
headless: true,
|
|
31
|
-
},
|
|
32
|
-
webServer: process.env.IMAGICMA_RUN_TEST_SKIP_WEBSERVER === "1"
|
|
33
|
-
? undefined
|
|
34
|
-
: {
|
|
35
|
-
command: "pnpm dev",
|
|
36
|
-
url: baseURL,
|
|
37
|
-
reuseExistingServer: true,
|
|
38
|
-
timeout: 120_000,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { test as base, expect } from "@playwright/test";
|
|
2
|
-
import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
|
|
5
|
-
// When run_test drives Playwright, it injects these env vars so fixtures can write
|
|
6
|
-
// browser/network/page-error evidence directly into .imagicma/runtime/run-test/<runId>/.
|
|
7
|
-
const runtimeRoot = process.env.IMAGICMA_RUN_TEST_RUNTIME_ROOT;
|
|
8
|
-
const runId = process.env.IMAGICMA_RUN_ID || "manual";
|
|
9
|
-
const failureResourceTypes = new Set(["document", "xhr", "fetch"]);
|
|
10
|
-
|
|
11
|
-
function appendJsonl(name: string, row: Record<string, unknown>): void {
|
|
12
|
-
if (!runtimeRoot) return;
|
|
13
|
-
appendFileSync(join(runtimeRoot, name), `${JSON.stringify(row)}\n`, "utf-8");
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const test = base.extend({
|
|
17
|
-
page: async ({ page }, use) => {
|
|
18
|
-
if (runtimeRoot) {
|
|
19
|
-
mkdirSync(join(runtimeRoot, "screenshots"), { recursive: true });
|
|
20
|
-
mkdirSync(join(runtimeRoot, "traces"), { recursive: true });
|
|
21
|
-
mkdirSync(join(runtimeRoot, "videos"), { recursive: true });
|
|
22
|
-
page.on("console", (message) => {
|
|
23
|
-
const type = message.type();
|
|
24
|
-
if (type !== "warning" && type !== "warn" && type !== "error") return;
|
|
25
|
-
appendJsonl("console-events.jsonl", {
|
|
26
|
-
tsMs: Date.now(),
|
|
27
|
-
runId,
|
|
28
|
-
type,
|
|
29
|
-
text: message.text(),
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
page.on("pageerror", (error) => appendJsonl("page-errors.jsonl", {
|
|
33
|
-
tsMs: Date.now(),
|
|
34
|
-
runId,
|
|
35
|
-
message: error.message,
|
|
36
|
-
}));
|
|
37
|
-
page.on("response", async (response) => {
|
|
38
|
-
const status = response.status();
|
|
39
|
-
const resourceType = response.request().resourceType();
|
|
40
|
-
if (status < 400 || !failureResourceTypes.has(resourceType)) return;
|
|
41
|
-
appendJsonl("network-failures.jsonl", {
|
|
42
|
-
tsMs: Date.now(),
|
|
43
|
-
runId,
|
|
44
|
-
url: response.url(),
|
|
45
|
-
method: response.request().method(),
|
|
46
|
-
status,
|
|
47
|
-
errorText: null,
|
|
48
|
-
resourceType,
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
page.on("requestfailed", (request) => appendJsonl("network-failures.jsonl", {
|
|
52
|
-
tsMs: Date.now(),
|
|
53
|
-
runId,
|
|
54
|
-
url: request.url(),
|
|
55
|
-
method: request.method(),
|
|
56
|
-
status: null,
|
|
57
|
-
errorText: request.failure()?.errorText ?? "requestfailed",
|
|
58
|
-
resourceType: request.resourceType(),
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
await use(page);
|
|
63
|
-
|
|
64
|
-
if (runtimeRoot) {
|
|
65
|
-
writeFileSync(join(runtimeRoot, "current-url.txt"), page.url(), "utf-8");
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
export { expect };
|