|
2 | 2 | * Copyright (C) Microsoft Corporation. All rights reserved.
|
3 | 3 | *--------------------------------------------------------*/
|
4 | 4 |
|
5 |
| -import ChildProcess = require("child_process"); |
| 5 | +import * as path from "path"; |
6 | 6 | import vscode = require("vscode");
|
7 |
| -import Window = vscode.window; |
8 | 7 | import { IFeature, LanguageClient } from "../feature";
|
9 | 8 | import { SessionManager } from "../session";
|
10 | 9 | import Settings = require("../settings");
|
@@ -40,22 +39,26 @@ export class PesterTestsFeature implements IFeature {
|
40 | 39 | request: "launch",
|
41 | 40 | type: "PowerShell",
|
42 | 41 | name: "PowerShell Launch Pester Tests",
|
43 |
| - script: "Invoke-Pester", |
| 42 | + script: `Invoke-Pester`, |
44 | 43 | args: [
|
45 |
| - `-Script "${uri.fsPath}"`, |
46 |
| - describeBlockName |
47 |
| - ? `-TestName '${describeBlockName}'` |
48 |
| - : "", |
| 44 | + "-Script", |
| 45 | + // Let PSES handle path quoting since it also handles escaping ' e.g. C:\temp\don't-use-this-path |
| 46 | + `${uri.fsPath}`, |
49 | 47 | ],
|
50 | 48 | internalConsoleOptions: "neverOpen",
|
51 | 49 | noDebug: !runInDebugger,
|
52 | 50 | createTemporaryIntegratedConsole: settings.debugging.createTemporaryIntegratedConsole,
|
53 | 51 | cwd:
|
54 | 52 | currentDocument.isUntitled
|
55 | 53 | ? vscode.workspace.rootPath
|
56 |
| - : currentDocument.fileName, |
| 54 | + : path.dirname(currentDocument.fileName), |
57 | 55 | };
|
58 | 56 |
|
| 57 | + if (describeBlockName) { |
| 58 | + launchConfig.args.push("-TestName"); |
| 59 | + launchConfig.args.push(`'${describeBlockName}'`); |
| 60 | + } |
| 61 | + |
59 | 62 | // Create or show the interactive console
|
60 | 63 | // TODO #367: Check if "newSession" mode is configured
|
61 | 64 | vscode.commands.executeCommand("PowerShell.ShowSessionConsole", true);
|
|
0 commit comments