From a0d28fa5cc21e46dfbb6ab81c3e61c98256f613f Mon Sep 17 00:00:00 2001
From: Danny McCormick <damccorm@microsoft.com>
Date: Wed, 5 Jun 2019 15:58:07 -0400
Subject: [PATCH] Fix linux tests

---
 __tests__/installer.test.ts | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts
index 591e4018..1bf2da17 100644
--- a/__tests__/installer.test.ts
+++ b/__tests__/installer.test.ts
@@ -10,6 +10,8 @@ process.env['RUNNER_TOOLSDIRECTORY'] = toolDir;
 process.env['RUNNER_TEMPDIRECTORY'] = tempDir;
 import * as installer from '../src/installer';
 
+const IS_WINDOWS = process.platform === 'win32';
+
 describe('installer tests', () => {
   beforeAll(() => {});
   beforeAll(async () => {
@@ -25,7 +27,7 @@ describe('installer tests', () => {
     expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
   }, 100000);
 
-  if (process.platform === 'win32') {
+  if (IS_WINDOWS) {
     it('Falls back to backup location if first one doesnt contain correct version', async () => {
       await installer.getNode('5.10.1');
       const nodeDir = path.join(toolDir, 'node', '5.10.1', os.arch());
@@ -39,7 +41,11 @@ describe('installer tests', () => {
       const nodeDir = path.join(toolDir, 'node', '0.12.18', os.arch());
 
       expect(fs.existsSync(`${nodeDir}.complete`)).toBe(true);
-      expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
+      if (IS_WINDOWS) {
+        expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
+      } else {
+        expect(fs.existsSync(path.join(nodeDir, 'bin', 'node'))).toBe(true);
+      }
     }, 100000);
   }
 
@@ -58,7 +64,11 @@ describe('installer tests', () => {
     const nodeDir = path.join(toolDir, 'node', '8.8.1', os.arch());
 
     expect(fs.existsSync(`${nodeDir}.complete`)).toBe(true);
-    expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
+    if (IS_WINDOWS) {
+      expect(fs.existsSync(path.join(nodeDir, 'node.exe'))).toBe(true);
+    } else {
+      expect(fs.existsSync(path.join(nodeDir, 'bin', 'node'))).toBe(true);
+    }
   }, 100000);
 
   it('Uses version of node installed in cache', async () => {