You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ja...@apache.org on 2018/02/15 14:46:17 UTC

[cordova-windows] 25/26: avoid crosspolution in tests that rely on ENV vars (uh, ugly)

This is an automated email from the ASF dual-hosted git repository.

janpio pushed a commit to branch janpio-msbuild_cleanup
in repository https://gitbox.apache.org/repos/asf/cordova-windows.git

commit 54fd1d12350b76a60e670cec6980b51e178de537
Author: Jan Piotrowski <pi...@gmail.com>
AuthorDate: Thu Feb 15 13:00:38 2018 +0100

    avoid crosspolution in tests that rely on ENV vars (uh, ugly)
---
 spec/unit/build.spec.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/spec/unit/build.spec.js b/spec/unit/build.spec.js
index ad25c99..f9f55fa 100644
--- a/spec/unit/build.spec.js
+++ b/spec/unit/build.spec.js
@@ -376,6 +376,9 @@ describe('run method', function () {
         var msBuildBinPath = path.join(customMSBuildPath, 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
         process.env.VSINSTALLDIR = customMSBuildPath;
+        // avoid crosspollution with MSBUILDDIR
+        var backupMSBUILDDIR = process.env.MSBUILDDIR;
+        delete process.env.MSBUILDDIR;
 
         spyOn(MSBuildTools, 'getMSBuildToolsAt')
             .and.returnValue(Q({
@@ -392,6 +395,7 @@ describe('run method', function () {
                 expect(fail).not.toHaveBeenCalled();
                 expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
                 delete process.env.VSINSTALLDIR;
+                process.env.MSBUILDDIR = backupMSBUILDDIR;
                 done();
             });
     });
@@ -400,6 +404,9 @@ describe('run method', function () {
         var msBuildBinPath = path.join('/some/path', 'MSBuild/15.0/Bin');
         var customMSBuildVersion = '15.0';
         process.env.MSBUILDDIR = msBuildBinPath;
+        // avoid crosspollution with VSINSTALLDIR
+        var backupVSINSTALLDIR = process.env.VSINSTALLDIR;
+        delete process.env.VSINSTALLDIR;
 
         spyOn(MSBuildTools, 'getMSBuildToolsAt')
             .and.returnValue(Q({
@@ -416,6 +423,7 @@ describe('run method', function () {
                 expect(fail).not.toHaveBeenCalled();
                 expect(MSBuildTools.getMSBuildToolsAt).toHaveBeenCalledWith(msBuildBinPath);
                 delete process.env.MSBUILDDIR;
+                process.env.VSINSTALLDIR = backupVSINSTALLDIR;
                 done();
             });
     });

-- 
To stop receiving notification emails like this one, please contact
janpio@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org