Skip to content

Commit

Permalink
Fix Test Executor In VS15 Post Preview 4 (#1406)
Browse files Browse the repository at this point in the history
**Bug**
The test executor can currently fail in vs15 post preview 4 because it tries to look up the nodejs.targets file in the global msbuild location. We now only install the targets file to the local, vs specific msbuild folder.

**Fix**
Similar to with the test discoverer, make sure we use the correct msbuild location
  • Loading branch information
mjbvz committed Nov 2, 2016
1 parent f4f6253 commit 8eb0b13
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions Nodejs/Product/TestAdapter/TestExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,23 +226,28 @@ select connection.LocalEndPoint.Port
}

private NodejsProjectSettings LoadProjectSettings(string projectFile) {
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
var buildEngine = new MSBuild.ProjectCollection(env);
var proj = buildEngine.LoadProject(projectFile);

var projectRootDir = Path.GetFullPath(Path.Combine(proj.DirectoryPath, proj.GetPropertyValue(CommonConstants.ProjectHome) ?? "."));

NodejsProjectSettings projSettings = new NodejsProjectSettings();

projSettings.ProjectRootDir = projectRootDir;
return new NodejsProjectSettings() {
ProjectRootDir = projectRootDir,

projSettings.WorkingDir = Path.GetFullPath(Path.Combine(projectRootDir, proj.GetPropertyValue(CommonConstants.WorkingDirectory) ?? "."));
WorkingDir = Path.GetFullPath(Path.Combine(projectRootDir, proj.GetPropertyValue(CommonConstants.WorkingDirectory) ?? ".")),

projSettings.NodeExePath =
Nodejs.GetAbsoluteNodeExePath(
NodeExePath = Nodejs.GetAbsoluteNodeExePath(
projectRootDir,
proj.GetPropertyValue(NodeProjectProperty.NodeExePath));

return projSettings;
proj.GetPropertyValue(NodeProjectProperty.NodeExePath))
};
}

private static void RecordEnd(IFrameworkHandle frameworkHandle, TestCase test, TestResult result, string stdout, string stderr, TestOutcome outcome) {
Expand Down

0 comments on commit 8eb0b13

Please sign in to comment.