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

Mock Uri in Jest with vscode-uri #245

Merged
merged 10 commits into from
Apr 7, 2021
Prev Previous commit
Next Next commit
Remove Commands module
Without using this data in multiple places, the wrapper module didn't serve much
purpose and hampered code readability a bit.
rogermparent committed Apr 6, 2021
commit 0309e58a0aa81ee7d1452eaf0a86ab0613b8d19f
2 changes: 1 addition & 1 deletion extension/src/IntegratedTerminal.test.ts
Original file line number Diff line number Diff line change
@@ -9,6 +9,6 @@ describe('runExperiment', () => {
const undef = await runExperiment()
expect(undef).toBeUndefined()

expect(terminalSpy).toBeCalledWith('dvc exp run ')
expect(terminalSpy).toBeCalledWith('dvc exp run')
})
})
4 changes: 1 addition & 3 deletions extension/src/IntegratedTerminal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Terminal, window, workspace } from 'vscode'
import { getRunExperimentCommand } from './cli/commands'
import { getReadyPythonExtension } from './extensions/python'
import { delay } from './util'

@@ -65,6 +64,5 @@ export class IntegratedTerminal {
}

export const runExperiment = (): Promise<void> => {
const runExperimentCommand = getRunExperimentCommand()
return IntegratedTerminal.run(runExperimentCommand)
return IntegratedTerminal.run('dvc exp run')
}
17 changes: 0 additions & 17 deletions extension/src/cli/commands.ts

This file was deleted.

13 changes: 6 additions & 7 deletions extension/src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { basename } from 'path'
import { Commands } from './commands'
import { ExperimentsRepoJSONOutput } from '../webviews/experiments/contract'
import { getPythonExecutionDetails } from '../extensions/python'
import { commands, Uri } from 'vscode'
@@ -35,31 +34,31 @@ export const add = (config: Config, fsPath: string): Promise<string> => {
export const getExperiments = async (
config: Config
): Promise<ExperimentsRepoJSONOutput> => {
const output = await execCommand(config, Commands.experiment_show)
const output = await execCommand(config, 'exp show --show-json')
return JSON.parse(output)
}

export const initializeDirectory = async (config: Config): Promise<string> => {
return execCommand(config, Commands.initialize_subdirectory)
return execCommand(config, 'init --subdir')
}

export const checkout = async (config: Config): Promise<string> => {
return execCommand(config, Commands.checkout)
return execCommand(config, 'checkout')
}

export const checkoutRecursive = async (config: Config): Promise<string> => {
return execCommand(config, Commands.checkout_recursive)
return execCommand(config, 'checkout --recursive')
}

export const getRoot = async (config: Config, cwd: string): Promise<string> => {
const output = await execCommand(config, Commands.root, { cwd })
const output = await execCommand(config, 'root', { cwd })
return output.trim()
}

export const listDvcOnlyRecursive = async (
config: Config
): Promise<string[]> => {
const output = await execCommand(config, `list . --dvc-only -R`)
const output = await execCommand(config, 'list . --dvc-only -R')
return output.trim().split('\n')
}