@gtkx/vitest 0.15.0 → 0.16.0
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 +1 -0
- package/dist/setup.js +26 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -71,6 +71,7 @@ render(<App />, "com.example.counter");
|
|
|
71
71
|
- **React 19** — Hooks, concurrent features, and the component model you know
|
|
72
72
|
- **Native GTK4 widgets** — Real native controls, not web components in a webview
|
|
73
73
|
- **Adwaita support** — Modern GNOME styling with Libadwaita components
|
|
74
|
+
- **Declarative animations** — Framer Motion-like API using native Adwaita animations
|
|
74
75
|
- **Hot Module Replacement** — Fast refresh during development
|
|
75
76
|
- **TypeScript first** — Full type safety with auto-generated bindings
|
|
76
77
|
- **CSS-in-JS styling** — Familiar styling patterns adapted for GTK
|
package/dist/setup.js
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { beforeAll } from "vitest";
|
|
2
4
|
const display = 100 + (process.pid % 5000);
|
|
5
|
+
const socketPath = `/tmp/.X11-unix/X${display}`;
|
|
3
6
|
const xvfb = spawn("Xvfb", [`:${display}`, "-screen", "0", "1024x768x24"], {
|
|
4
7
|
stdio: "ignore",
|
|
5
8
|
detached: true,
|
|
6
9
|
});
|
|
10
|
+
const xvfbPid = xvfb.pid;
|
|
7
11
|
xvfb.unref();
|
|
12
|
+
const killXvfb = () => {
|
|
13
|
+
if (xvfbPid !== undefined) {
|
|
14
|
+
try {
|
|
15
|
+
process.kill(xvfbPid, "SIGTERM");
|
|
16
|
+
}
|
|
17
|
+
catch { }
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
process.on("exit", killXvfb);
|
|
8
21
|
process.env.GDK_BACKEND = "x11";
|
|
9
22
|
process.env.GSK_RENDERER = "cairo";
|
|
10
23
|
process.env.LIBGL_ALWAYS_SOFTWARE = "1";
|
|
11
24
|
process.env.DISPLAY = `:${display}`;
|
|
25
|
+
const waitForDisplay = async (timeout = 5000) => {
|
|
26
|
+
const start = Date.now();
|
|
27
|
+
while (Date.now() - start < timeout) {
|
|
28
|
+
if (existsSync(socketPath)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
32
|
+
}
|
|
33
|
+
throw new Error(`Xvfb display :${display} did not become available within ${timeout}ms`);
|
|
34
|
+
};
|
|
35
|
+
beforeAll(async () => {
|
|
36
|
+
await waitForDisplay();
|
|
37
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/vitest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Vitest plugin for GTKX applications with Xvfb display isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"vitest": "^4.0.
|
|
39
|
+
"vitest": "^4.0.18"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"vitest": ">=4"
|