-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add multi-root workspace support for runAllTests command * Add multi-root workspace support for runAllTestsInActiveFile command * Add multi-root workspace support for runAllTestsInPath command * Clean up code * Fix broken tests * Update changelog
- Loading branch information
1 parent
9b58078
commit bd908e2
Showing
8 changed files
with
78 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
const vscode = require('vscode') | ||
|
||
const TERMINAL_NAME = 'Just Testing' | ||
const LAST_COMMAND = 'lastCommand' | ||
|
||
async function runTerminalCommand (extensionContext, command) { | ||
async function runTerminalCommand (extensionContext, command, workspaceFolder = undefined) { | ||
await vscode.workspace.saveAll() | ||
extensionContext.workspaceState.update(LAST_COMMAND, command) | ||
|
||
const terminal = obtainTerminal() | ||
const terminal = obtainTerminal(workspaceFolder || getActiveWorkspaceFolder()) | ||
terminal.show(true) | ||
terminal.sendText(command) | ||
} | ||
|
||
function obtainTerminal () { | ||
const terminal = vscode.window.terminals.find(terminal => terminal.name === TERMINAL_NAME) | ||
function obtainTerminal (workspaceFolder) { | ||
const name = `Just Testing: ${workspaceFolder.name}` | ||
const terminal = vscode.window.terminals.find(terminal => terminal.name === name) | ||
if (terminal) return terminal | ||
return vscode.window.createTerminal({ name, cwd: workspaceFolder.uri }) | ||
} | ||
|
||
return vscode.window.createTerminal(TERMINAL_NAME) | ||
function getActiveWorkspaceFolder () { | ||
const editor = vscode.window.activeTextEditor | ||
if (editor === undefined) { | ||
return vscode.workspace.workspaceFolders[0] | ||
} | ||
return vscode.workspace.getWorkspaceFolder(editor.document.uri) | ||
} | ||
|
||
module.exports = { LAST_COMMAND, runTerminalCommand } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters