From 0dbc2e7f12e45db20808ea90525f3e2ea504b5df Mon Sep 17 00:00:00 2001 From: francisco souza Date: Sun, 1 Mar 2020 21:34:51 -0500 Subject: [PATCH] Fix tests for gobin on Windows --- __tests__/gobin.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/__tests__/gobin.test.ts b/__tests__/gobin.test.ts index 8a578a4..a34fc21 100644 --- a/__tests__/gobin.test.ts +++ b/__tests__/gobin.test.ts @@ -1,4 +1,5 @@ import * as gobin from '../src/gobin'; +import * as path from 'path'; jest.mock('child_process'); @@ -6,16 +7,17 @@ describe('gobin', () => { const childProcess = require('child_process'); let execSpy: jest.SpyInstance; + let gopath = path.join('home', 'user', 'go'); beforeEach(() => { execSpy = jest.spyOn(childProcess, 'exec'); execSpy.mockImplementation((_command, callback) => { - callback('', {stdout: '/home/user/go', stderr: ''}); + callback('', {stdout: gopath, stderr: ''}); }); }); it('should return ${GOPATH}/bin', async () => { const gobinPath = await gobin.getGOBIN('...'); - expect(gobinPath).toBe('/home/user/go/bin'); + expect(gobinPath).toBe(path.join(gopath, 'bin')); }); });