gobin: use execFile instead of exec to query GOPATH

Should fix the behavior on Windows.
This commit is contained in:
francisco souza 2020-03-01 22:06:59 -05:00
parent 0dbc2e7f12
commit 4241f446d8
No known key found for this signature in database
GPG key ID: 3F6AA3B701F20B3E
3 changed files with 7 additions and 7 deletions

View file

@ -6,12 +6,12 @@ jest.mock('child_process');
describe('gobin', () => {
const childProcess = require('child_process');
let execSpy: jest.SpyInstance;
let execFileSpy: jest.SpyInstance;
let gopath = path.join('home', 'user', 'go');
beforeEach(() => {
execSpy = jest.spyOn(childProcess, 'exec');
execSpy.mockImplementation((_command, callback) => {
execFileSpy = jest.spyOn(childProcess, 'execFile');
execFileSpy.mockImplementation((_file, _args, callback) => {
callback('', {stdout: gopath, stderr: ''});
});
});