|
|
|
@ -523,7 +523,8 @@ describe('setup-go', () => {
|
|
|
|
|
return '/Users/testuser/go';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mkdirpSpy.mockImplementation(async () => {});
|
|
|
|
|
mkdirpSpy.mockImplementation(async () => {
|
|
|
|
|
});
|
|
|
|
|
existsSpy.mockImplementation(() => {
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
@ -957,4 +958,48 @@ use .
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe('tool-versions-file', () => {
|
|
|
|
|
const toolVersionsFile = `terraform 1.3.7
|
|
|
|
|
golang 1.16.3
|
|
|
|
|
python 3.10.11
|
|
|
|
|
ruby 3.2.1
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
it('reads version from .tool-versions when specified', async () => {
|
|
|
|
|
inputs['tool-versions-file'] = '.special-tool-versions'
|
|
|
|
|
existsSpy.mockImplementation(() => true);
|
|
|
|
|
readFileSpy.mockImplementation(() => Buffer.from(toolVersionsFile))
|
|
|
|
|
|
|
|
|
|
await main.run();
|
|
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.16.3');
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.16.3...');
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('matching 1.16.3...');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('is overwritten by go-version param', async () => {
|
|
|
|
|
inputs['go-version'] = '1.18.2'
|
|
|
|
|
inputs['tool-versions-file'] = '.special-tool-versions'
|
|
|
|
|
existsSpy.mockImplementation(() => true);
|
|
|
|
|
readFileSpy.mockImplementation(() => Buffer.from(toolVersionsFile))
|
|
|
|
|
|
|
|
|
|
await main.run();
|
|
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.18.2');
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.18.2...');
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('matching 1.18.2...');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('uses .tool-versions as a default when no version specified', async () => {
|
|
|
|
|
existsSpy.mockImplementation(() => true);
|
|
|
|
|
readFileSpy.mockImplementation(() => Buffer.from(toolVersionsFile))
|
|
|
|
|
|
|
|
|
|
await main.run();
|
|
|
|
|
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.16.3');
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.16.3...');
|
|
|
|
|
expect(logSpy).toHaveBeenCalledWith('matching 1.16.3...');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|