Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Nodejs/Product/Nodejs/NodejsConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ internal class NodejsConstants {
internal const string TypeScript = "TypeScript";

internal const string NodeToolsProcessIdEnvironmentVariable = "_NTVS_PID";
internal const string NodeToolsVsInstallRootEnvironmentVariable = "_NTVS_VSINSTALLROOT";

public static string NtvsLocalAppData {
get {
Expand Down
7 changes: 7 additions & 0 deletions Nodejs/Product/Nodejs/NodejsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ protected override void Initialize() {
// The variable is inherited by child processes backing Test Explorer, and is used in
// the NTVS test discoverer and test executor to connect back to VS.
Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsProcessIdEnvironmentVariable, Process.GetCurrentProcess().Id.ToString());

#if DEV15
var root = Environment.GetEnvironmentVariable("VsInstallRoot");
if (!string.IsNullOrEmpty(root)) {
Environment.SetEnvironmentVariable(NodejsConstants.NodeToolsVsInstallRootEnvironmentVariable, root);
}
#endif
}

public static LANGPREFERENCES3[] GetNodejsLanguagePreferencesFromTypeScript(IVsTextManager4 textMgr) {
Expand Down
11 changes: 10 additions & 1 deletion Nodejs/Product/TestAdapter/TestDiscoverer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove
ValidateArg.NotNull(discoverySink, "discoverySink");
ValidateArg.NotNull(logger, "logger");

using (var buildEngine = new MSBuild.ProjectCollection()) {
var env = new Dictionary<string, string>();
#if DEV15
var root = Environment.GetEnvironmentVariable(NodejsConstants.NodeToolsVsInstallRootEnvironmentVariable);
if (!string.IsNullOrEmpty(root)) {
env["VsInstallRoot"] = root;
env["MSBuildExtensionsPath32"] = Path.Combine(root, "MSBuild");
}
#endif

using (var buildEngine = new MSBuild.ProjectCollection(env)) {
try {
// Load all the test containers passed in (.njsproj msbuild files)
foreach (string source in sources) {
Expand Down