@tui-sandbox/library 11.4.1 → 11.6.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/CHANGELOG.md +14 -0
- package/dist/browser/assets/{index-AMa2FE-g.js → index-BIcK2_KN.js} +1 -1
- package/dist/browser/index.html +1 -1
- package/dist/src/client/cypress-assertions.js +14 -12
- package/dist/src/client/cypress-assertions.js.map +1 -1
- package/dist/src/scripts/commands/commandRunOnce.d.ts +1 -0
- package/dist/src/scripts/commands/commandRunOnce.js +27 -0
- package/dist/src/scripts/commands/commandRunOnce.js.map +1 -0
- package/dist/src/scripts/parseArguments.d.ts +4 -1
- package/dist/src/scripts/parseArguments.js +11 -1
- package/dist/src/scripts/parseArguments.js.map +1 -1
- package/dist/src/scripts/parseArguments.test.js +4 -0
- package/dist/src/scripts/parseArguments.test.js.map +1 -1
- package/dist/src/scripts/tui.js +5 -0
- package/dist/src/scripts/tui.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
- package/src/client/cypress-assertions.ts +14 -16
- package/src/scripts/commands/commandRunOnce.ts +35 -0
- package/src/scripts/parseArguments.test.ts +5 -0
- package/src/scripts/parseArguments.ts +17 -2
- package/src/scripts/tui.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tui-sandbox/library",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/mikavilpas/tui-sandbox"
|
|
@@ -12,11 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@catppuccin/palette": "1.7.1",
|
|
15
|
-
"@trpc/client": "11.4.
|
|
16
|
-
"@trpc/server": "11.4.
|
|
15
|
+
"@trpc/client": "11.4.4",
|
|
16
|
+
"@trpc/server": "11.4.4",
|
|
17
17
|
"@xterm/addon-fit": "0.10.0",
|
|
18
18
|
"@xterm/addon-unicode11": "0.8.0",
|
|
19
19
|
"@xterm/xterm": "5.5.0",
|
|
20
|
+
"concurrently": "9.2.0",
|
|
20
21
|
"cors": "2.8.5",
|
|
21
22
|
"cypress": "14.5.3",
|
|
22
23
|
"dree": "5.1.5",
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
"@types/command-exists": "1.2.3",
|
|
33
34
|
"@types/cors": "2.8.19",
|
|
34
35
|
"@types/express": "5.0.3",
|
|
35
|
-
"@types/node": "24.
|
|
36
|
+
"@types/node": "24.2.0",
|
|
36
37
|
"nodemon": "3.1.10",
|
|
37
38
|
"tsx": "4.20.3",
|
|
38
39
|
"vite": "7.0.6",
|
|
@@ -10,28 +10,26 @@
|
|
|
10
10
|
* Limitation: text spanning multiple lines will not be detected.
|
|
11
11
|
*/
|
|
12
12
|
export function textIsVisibleWithColor(text: string, color: string): Cypress.Chainable<JQuery> {
|
|
13
|
-
return cy
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
return cy
|
|
14
|
+
.get("div.xterm-rows span")
|
|
15
|
+
.filter(`:contains(${text})`)
|
|
16
|
+
.should("exist") // ensures there's at least one match
|
|
17
|
+
.should($els => {
|
|
18
|
+
const colors = $els.map((_, el) => window.getComputedStyle(el).color).toArray()
|
|
19
|
+
expect(colors).to.include(color)
|
|
18
20
|
})
|
|
19
|
-
|
|
20
|
-
expect(JSON.stringify(colors.toArray())).to.contain(color)
|
|
21
|
-
})
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
/** Like `textIsVisibleWithColor`, but checks the background color instead
|
|
25
24
|
* of the text color.
|
|
26
25
|
*/
|
|
27
26
|
export function textIsVisibleWithBackgroundColor(text: string, color: string): Cypress.Chainable<JQuery> {
|
|
28
|
-
return cy
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
return cy
|
|
28
|
+
.get("div.xterm-rows span")
|
|
29
|
+
.filter(`:contains(${text})`)
|
|
30
|
+
.should("exist") // ensures there's at least one match
|
|
31
|
+
.should($els => {
|
|
32
|
+
const colors = $els.map((_, el) => window.getComputedStyle(el).backgroundColor).toArray()
|
|
33
|
+
expect(colors).to.include(color)
|
|
33
34
|
})
|
|
34
|
-
|
|
35
|
-
expect(JSON.stringify(colors.toArray())).to.contain(color)
|
|
36
|
-
})
|
|
37
35
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import concurrently from "concurrently"
|
|
2
|
+
import { debuglog } from "util"
|
|
3
|
+
|
|
4
|
+
const log = debuglog("tui-sandbox.commandRunOnce")
|
|
5
|
+
|
|
6
|
+
export async function commandRunOnce(): Promise<void> {
|
|
7
|
+
const job = concurrently(
|
|
8
|
+
[
|
|
9
|
+
{
|
|
10
|
+
name: "server",
|
|
11
|
+
command: "tui start",
|
|
12
|
+
prefixColor: "blue",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "cypress",
|
|
16
|
+
command: `'wait-on --timeout 60000 http-get://127.0.0.1:3000/ping && pnpm exec cypress run --config baseUrl=http://127.0.0.1:3000 --quiet'`,
|
|
17
|
+
prefixColor: "yellow",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
{
|
|
21
|
+
killOthersOn: ["failure", "success"],
|
|
22
|
+
padPrefix: true, // makes all the prefixes the same length
|
|
23
|
+
successCondition: "command-cypress", // the test run that determines success/failure
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
await job.result.then(
|
|
28
|
+
_ => {
|
|
29
|
+
log("All commands completed successfully")
|
|
30
|
+
},
|
|
31
|
+
(err: unknown) => {
|
|
32
|
+
log("One or more commands failed. Debug info follows.", err)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -21,3 +21,8 @@ it(`can parse "start"`, async () => {
|
|
|
21
21
|
expect(await parseArguments(["start"])).toEqual({ action: "start" })
|
|
22
22
|
expect(await parseArguments(["start", "foo"])).toBeUndefined()
|
|
23
23
|
})
|
|
24
|
+
|
|
25
|
+
it(`can parse "run"`, async () => {
|
|
26
|
+
expect(await parseArguments(["run"])).toEqual({ action: "run" })
|
|
27
|
+
expect(await parseArguments(["run", "foo"])).toBeUndefined()
|
|
28
|
+
})
|
|
@@ -14,7 +14,7 @@ export const parseArguments = async (args: string[]): Promise<ParseArgumentsResu
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
{
|
|
17
|
-
// tui neovim exec <command>
|
|
17
|
+
// tui neovim exec <command>
|
|
18
18
|
const schema = z.tuple([z.literal("neovim"), z.literal("exec"), z.string()])
|
|
19
19
|
const execArguments = schema.safeParse(args)
|
|
20
20
|
if (execArguments.success) {
|
|
@@ -37,9 +37,20 @@ export const parseArguments = async (args: string[]): Promise<ParseArgumentsResu
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
{
|
|
42
|
+
// tui start
|
|
43
|
+
const schema = z.tuple([z.literal("run")])
|
|
44
|
+
const result = schema.safeParse(args)
|
|
45
|
+
if (result.success) {
|
|
46
|
+
return {
|
|
47
|
+
action: "run",
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
export type ParseArgumentsResult = NeovimPrepare | NeovimExec | TuiStart
|
|
53
|
+
export type ParseArgumentsResult = NeovimPrepare | NeovimExec | TuiStart | TuiRunOnce
|
|
43
54
|
|
|
44
55
|
export type NeovimExec = {
|
|
45
56
|
action: "neovim exec"
|
|
@@ -53,3 +64,7 @@ export type NeovimPrepare = {
|
|
|
53
64
|
export type TuiStart = {
|
|
54
65
|
action: "start"
|
|
55
66
|
}
|
|
67
|
+
|
|
68
|
+
export type TuiRunOnce = {
|
|
69
|
+
action: "run"
|
|
70
|
+
}
|
package/src/scripts/tui.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from "node:path"
|
|
2
2
|
import type { TestServerConfig } from "../server/index.js"
|
|
3
|
+
import { commandRunOnce } from "./commands/commandRunOnce.js"
|
|
3
4
|
import { commandTuiNeovimExec } from "./commands/commandTuiNeovimExec.js"
|
|
4
5
|
import { commandTuiNeovimPrepare } from "./commands/commandTuiNeovimPrepare.js"
|
|
5
6
|
import { commandTuiStart } from "./commands/commandTuiStart.js"
|
|
@@ -40,6 +41,10 @@ switch (command?.action) {
|
|
|
40
41
|
await commandTuiStart()
|
|
41
42
|
break
|
|
42
43
|
}
|
|
44
|
+
case "run": {
|
|
45
|
+
await commandRunOnce()
|
|
46
|
+
break
|
|
47
|
+
}
|
|
43
48
|
default: {
|
|
44
49
|
command satisfies undefined
|
|
45
50
|
showUsageAndExit()
|