Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to dependencies #128

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 62 additions & 4 deletions integration-tests/cypress/support/tui-sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
//
// This file is autogenerated by tui-sandbox. Do not edit it directly.
//
import type { GenericNeovimBrowserApi } from "@tui-sandbox/library/dist/src/browser/neovim-client"
import type {
BlockingCommandClientInput,
GenericNeovimBrowserApi,
GenericTerminalBrowserApi,
} from "@tui-sandbox/library/dist/src/browser/neovim-client"
import type {
ExCommandClientInput,
LuaCodeClientInput,
} from "@tui-sandbox/library/dist/src/server/server"
Expand All @@ -15,12 +17,29 @@ import type {
StartNeovimGenericArguments,
TestDirectory,
} from "@tui-sandbox/library/dist/src/server/types"
import type { BlockingCommandClientInput } from "@tui-sandbox/library/src/server/blockingCommandInputSchema"
import type { StartTerminalGenericArguments } from "@tui-sandbox/library/src/server/terminal/TerminalTestApplication"
import type { OverrideProperties } from "type-fest"
import type {
MyTestDirectory,
MyTestDirectoryFile,
} from "../../MyTestDirectory"

export type TerminalTestApplicationContext = {
/** Types text into the terminal, making the terminal application receive the
* keystrokes as input. Requires the application to be running. */
typeIntoTerminal(text: string, options?: Partial<Cypress.TypeOptions>): void

/** Runs a shell command in a blocking manner, waiting for the command to
* finish before returning. Requires the terminal to be running. */
runBlockingShellCommand(
input: MyBlockingCommandClientInput,
): Cypress.Chainable<BlockingShellCommandOutput>

/** The test directory, providing type-safe access to its file and directory structure */
dir: TestDirectory<MyTestDirectory>
}

/** The api that can be used in tests after a Neovim instance has been started. */
export type NeovimContext = {
/** Types text into the terminal, making the terminal application receive
Expand All @@ -30,7 +49,7 @@ export type NeovimContext = {
/** Runs a shell command in a blocking manner, waiting for the command to
* finish before returning. Requires neovim to be running. */
runBlockingShellCommand(
input: BlockingCommandClientInput,
input: MyBlockingCommandClientInput,
): Cypress.Chainable<BlockingShellCommandOutput>

/** Runs a shell command in a blocking manner, waiting for the command to
Expand Down Expand Up @@ -99,6 +118,32 @@ Cypress.Commands.add(
},
)

Cypress.Commands.add(
"startTerminalApplication",
(args: StartTerminalGenericArguments) => {
cy.window().then(async (win) => {
const terminal: GenericTerminalBrowserApi =
await win.startTerminalApplication(args)

Cypress.Commands.addAll({
terminal_runBlockingShellCommand: terminal.runBlockingShellCommand,
})

const api: TerminalTestApplicationContext = {
dir: terminal.dir as TestDirectory<MyTestDirectory>,
runBlockingShellCommand(input) {
return cy.terminal_runBlockingShellCommand(input)
},
typeIntoTerminal(text, options) {
cy.typeIntoTerminal(text, options)
},
}

return api
})
},
)

Cypress.Commands.add(
"typeIntoTerminal",
(text: string, options?: Partial<Cypress.TypeOptions>) => {
Expand All @@ -117,10 +162,18 @@ before(function () {
cy.intercept({ resourceType: /xhr|fetch/ }, { log: false })
})

export type MyBlockingCommandClientInput = OverrideProperties<
BlockingCommandClientInput,
{ cwdRelative?: MyTestDirectoryFile | undefined }
>

declare global {
namespace Cypress {
interface Chainable {
startNeovim(args?: MyStartNeovimServerArguments): Chainable<NeovimContext>
startTerminalApplication(
args: StartTerminalGenericArguments,
): Chainable<TerminalTestApplicationContext>

/** Types text into the terminal, making the terminal application receive
* the keystrokes as input. Requires neovim to be running. */
Expand All @@ -132,7 +185,7 @@ declare global {
/** Runs a shell command in a blocking manner, waiting for the command to
* finish before returning. Requires neovim to be running. */
nvim_runBlockingShellCommand(
input: BlockingCommandClientInput,
input: MyBlockingCommandClientInput,
): Chainable<BlockingShellCommandOutput>

nvim_runLuaCode(input: LuaCodeClientInput): Chainable<RunLuaCodeOutput>
Expand All @@ -143,6 +196,10 @@ declare global {
nvim_runExCommand(
input: ExCommandClientInput,
): Chainable<RunExCommandOutput>

terminal_runBlockingShellCommand(
input: MyBlockingCommandClientInput,
): Chainable<BlockingShellCommandOutput>
}
}
}
Expand Down Expand Up @@ -171,5 +228,6 @@ afterEach(async () => {
])
} finally {
clearTimeout(timeoutId) // Ensure the timeout is cleared
testNeovim = undefined
}
})
2 changes: 1 addition & 1 deletion integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"devDependencies": {
"@eslint/js": "9.20.0",
"@tui-sandbox/library": "9.0.1",
"@tui-sandbox/library": "9.3.0",
"@types/node": "22.13.1",
"@types/tinycolor2": "1.4.6",
"concurrently": "9.1.2",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"prettier-plugin-organize-imports": "4.1.0",
"prettier-plugin-packagejson": "2.5.6"
},
"packageManager": "pnpm@10.2.1+sha256.f988f0d93b87e1da2d8cdf6ac7f45a01c6f843ae3606b4ca0f2ffd713b85f975",
"packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af",
"pnpm": {
"onlyBuiltDependencies": [
"core-js",
Expand Down
Loading
Loading