Skip to content

Commit 70e5f85

Browse files
authored
Merge pull request #896 from nextcloud-libraries/fix/cypress-occ
feat(cypress): return exec context to allow working with exit code or output
2 parents e33b377 + fefddd2 commit 70e5f85

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/commands/docker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ function getContainerName(): Cypress.Chainable<string> {
1212
})
1313
}
1414

15-
export function runCommand(command: string, options?: Partial<Cypress.ExecOptions>) {
15+
export function runCommand(command: string, options?: Partial<Cypress.ExecOptions>): Cypress.Chainable<Cypress.Exec> {
1616
const env = Object.entries(options?.env ?? {})
1717
.map(([name, value]) => `-e '${name}=${value}'`)
1818
.join(' ')
1919

20-
getContainerName()
20+
return getContainerName()
2121
.then((containerName) => {
2222
// Wrapping command inside bash -c "..." to allow using '*'.
2323
return cy.exec(`docker exec --user www-data --workdir /var/www/html ${env} ${containerName} bash -c "${command}"`, options)

lib/commands/getNc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import type { Selector } from "../selectors"
6+
import type { Selector } from "../selectors/index.ts"
77

88
export const getNc = function(selector: Selector, args: Object = {}): Cypress.Chainable<JQuery<HTMLElement>> {
99
if (typeof selector !== 'function') {

lib/commands/occ.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import { runCommand } from "./docker"
6+
import { runCommand } from "./docker.ts"
77

8-
export function runOccCommand(command: string, options?: Partial<Cypress.ExecOptions>) {
9-
runCommand(`php ./occ ${command}`, options)
8+
export function runOccCommand(command: string, options?: Partial<Cypress.ExecOptions>): Cypress.Chainable<Cypress.Exec> {
9+
return runCommand(`php ./occ ${command}`, options)
1010
}

0 commit comments

Comments
 (0)