Skip to content

Commit

Permalink
Add an arg in getTestFlags as suggested in microsoft#2285 (review)
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptonist committed Feb 4, 2019
1 parent b6094ad commit 313c3cd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import path = require('path');
import vscode = require('vscode');
import util = require('util');
import { parseEnvFile, getCurrentGoWorkspaceFromGOPATH } from './goPath';
import { getToolsEnvVars, getGoVersion, LineBuffer, SemVersion, resolvePath, getCurrentGoPath, getBinPath } from './util';
import { getToolsEnvVars, getGoVersion, LineBuffer, SemVersion, resolvePath, getCurrentGoPath, getBinPath, removeRunFlag } from './util';
import { GoDocumentSymbolProvider } from './goOutline';
import { getNonVendorPackages } from './goPackages';
import { getCurrentPackage } from './goModules';
Expand Down Expand Up @@ -87,9 +87,12 @@ export function getTestEnvVars(config: vscode.WorkspaceConfiguration): any {
return envVars;
}

export function getTestFlags(goConfig: vscode.WorkspaceConfiguration, args?: any): string[] {
export function getTestFlags(goConfig: vscode.WorkspaceConfiguration, args?: any, useRunFlag= true): string[] {
let testFlags: string[] = goConfig['testFlags'] || goConfig['buildFlags'] || [];
testFlags = testFlags.map(x => resolvePath(x)); // Use copy of the flags, dont pass the actual object from config
if (useRunFlag === false) {
testFlags = removeRunFlag(testFlags);
}
return (args && args.hasOwnProperty('flags') && Array.isArray(args['flags'])) ? args['flags'] : testFlags;
}

Expand Down

0 comments on commit 313c3cd

Please sign in to comment.