help.test.ts 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. import { test } from "@microsoft/tui-test"
  2. import { CLINE_BIN } from "./helpers/constants.js"
  3. import { expectVisible, testEnv } from "./utils.js"
  4. const HELP_TERMINAL = { columns: 120, rows: 50 }
  5. // ===========================================================================
  6. // cline --help (root help)
  7. // ===========================================================================
  8. test.describe("cline --help", () => {
  9. test.use({
  10. program: { file: CLINE_BIN, args: ["--help"] },
  11. env: testEnv("claude-sonnet-4.6"),
  12. ...HELP_TERMINAL,
  13. })
  14. test("shows Usage line and lists all subcommands", async ({ terminal }) => {
  15. await expectVisible(terminal, [
  16. "Usage:",
  17. "task|t",
  18. "history|h",
  19. "config [options]",
  20. "auth [options]",
  21. "version",
  22. "update [options]",
  23. "dev ",
  24. ])
  25. })
  26. test("shows all root-level option flags", async ({ terminal }) => {
  27. await expectVisible(terminal, [
  28. "--act",
  29. "--plan",
  30. "--yolo",
  31. "--timeout",
  32. "--model",
  33. "--verbose",
  34. "--cwd",
  35. "--config",
  36. "--thinking",
  37. "--reasoning-effort",
  38. "--max-consecutive-mistakes",
  39. "--json",
  40. "--double-check-completion",
  41. "--acp",
  42. "--tui",
  43. "--taskId",
  44. ])
  45. })
  46. })
  47. // ===========================================================================
  48. // cline -h (short help flag)
  49. // ===========================================================================
  50. test.describe("cline -h", () => {
  51. test.use({
  52. program: { file: CLINE_BIN, args: ["-h"] },
  53. env: testEnv("claude-sonnet-4.6"),
  54. ...HELP_TERMINAL,
  55. })
  56. test("shows Usage line with short flag", async ({ terminal }) => {
  57. await expectVisible(terminal, "Usage:")
  58. })
  59. })
  60. // ===========================================================================
  61. // cline task --help
  62. // ===========================================================================
  63. test.describe("cline task --help", () => {
  64. test.use({
  65. program: { file: CLINE_BIN, args: ["task", "--help"] },
  66. env: testEnv("claude-sonnet-4.6"),
  67. ...HELP_TERMINAL,
  68. })
  69. test("shows task usage, prompt argument, and all flags", async ({ terminal }) => {
  70. await expectVisible(terminal, [
  71. "Usage:",
  72. "prompt",
  73. "--act",
  74. "--plan",
  75. "--yolo",
  76. "--timeout",
  77. "--model",
  78. "--verbose",
  79. "--cwd",
  80. "--config",
  81. "--thinking",
  82. "--reasoning-effort",
  83. "--max-consecutive-mistakes",
  84. "--json",
  85. "--double-check-completion",
  86. "--taskId",
  87. ])
  88. })
  89. })
  90. // ===========================================================================
  91. // cline t --help (task alias)
  92. // ===========================================================================
  93. test.describe("cline t --help (task alias)", () => {
  94. test.use({
  95. program: { file: CLINE_BIN, args: ["t", "--help"] },
  96. env: testEnv("claude-sonnet-4.6"),
  97. ...HELP_TERMINAL,
  98. })
  99. test("shows task usage and flags via alias", async ({ terminal }) => {
  100. await expectVisible(terminal, ["Usage:", "--yolo"])
  101. })
  102. })
  103. // ===========================================================================
  104. // cline history --help
  105. // ===========================================================================
  106. test.describe("cline history --help", () => {
  107. test.use({
  108. program: { file: CLINE_BIN, args: ["history", "--help"] },
  109. env: testEnv("claude-sonnet-4.6"),
  110. ...HELP_TERMINAL,
  111. })
  112. test("shows history usage and all flags", async ({ terminal }) => {
  113. await expectVisible(terminal, ["Usage:", "--limit", "--page", "--config"])
  114. })
  115. })
  116. // ===========================================================================
  117. // cline h --help (history alias)
  118. // ===========================================================================
  119. test.describe("cline h --help (history alias)", () => {
  120. test.use({
  121. program: { file: CLINE_BIN, args: ["h", "--help"] },
  122. env: testEnv("claude-sonnet-4.6"),
  123. ...HELP_TERMINAL,
  124. })
  125. test("shows history usage and flags via alias", async ({ terminal }) => {
  126. await expectVisible(terminal, ["Usage:", "--limit"])
  127. })
  128. })
  129. // ===========================================================================
  130. // cline config --help
  131. // ===========================================================================
  132. test.describe("cline config --help", () => {
  133. test.use({
  134. program: { file: CLINE_BIN, args: ["config", "--help"] },
  135. env: testEnv("claude-sonnet-4.6"),
  136. ...HELP_TERMINAL,
  137. })
  138. test("shows config usage and --config flag", async ({ terminal }) => {
  139. await expectVisible(terminal, ["Usage:", "--config"])
  140. })
  141. })
  142. // ===========================================================================
  143. // cline auth --help
  144. // ===========================================================================
  145. test.describe("cline auth --help", () => {
  146. test.use({
  147. program: { file: CLINE_BIN, args: ["auth", "--help"] },
  148. env: testEnv("claude-sonnet-4.6"),
  149. ...HELP_TERMINAL,
  150. })
  151. test("shows auth usage and all flags", async ({ terminal }) => {
  152. await expectVisible(terminal, [
  153. "Usage:",
  154. "--provider",
  155. "--apikey",
  156. "--modelid",
  157. "--baseurl",
  158. "--verbose",
  159. "--cwd",
  160. "--config",
  161. ])
  162. })
  163. })
  164. // ===========================================================================
  165. // cline version --help
  166. // ===========================================================================
  167. test.describe("cline version --help", () => {
  168. test.use({
  169. program: { file: CLINE_BIN, args: ["version", "--help"] },
  170. env: testEnv("claude-sonnet-4.6"),
  171. ...HELP_TERMINAL,
  172. })
  173. test("shows version command usage", async ({ terminal }) => {
  174. await expectVisible(terminal, "Usage:")
  175. })
  176. })
  177. // ===========================================================================
  178. // cline update --help
  179. // ===========================================================================
  180. test.describe("cline update --help", () => {
  181. test.use({
  182. program: { file: CLINE_BIN, args: ["update", "--help"] },
  183. env: testEnv("claude-sonnet-4.6"),
  184. ...HELP_TERMINAL,
  185. })
  186. test("shows update usage and --verbose flag", async ({ terminal }) => {
  187. await expectVisible(terminal, ["Usage:", "--verbose"])
  188. })
  189. })
  190. // ===========================================================================
  191. // cline dev --help
  192. // ===========================================================================
  193. test.describe("cline dev --help", () => {
  194. test.use({
  195. program: { file: CLINE_BIN, args: ["dev", "--help"] },
  196. env: testEnv("claude-sonnet-4.6"),
  197. ...HELP_TERMINAL,
  198. })
  199. test("shows dev usage and lists log subcommand", async ({ terminal }) => {
  200. await expectVisible(terminal, ["Usage:", "log"])
  201. })
  202. })