Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/cli/services/apt.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ describe('cli/services/apt.service', () => {
mocks.execa.mockRejectedValueOnce(new Error('not installed'));
await svc.install('some-pkg');
expect(mocks.execa).toHaveBeenCalledTimes(3);
expect(mocks.execa).toHaveBeenCalledWith('apt-get', ['-qq', 'update'], {
env: { DEBIAN_FRONTEND: 'noninteractive' },
});
expect(mocks.execa).toHaveBeenCalledWith(
'apt-get',
['-qq', 'install', '-y', 'some-pkg'],
{ env: { DEBIAN_FRONTEND: 'noninteractive' } },
);
expect(mocks.writeFile).not.toHaveBeenCalled();
expect(mocks.rm).not.toHaveBeenCalled();
});
Expand Down
9 changes: 6 additions & 3 deletions src/cli/services/apt.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export class AptService {
private readonly envSvc!: EnvService;

/**
* Installs the packages which are not installed yet, honouring the apt proxy.
* Installs the packages which are not installed yet, honouring the apt
* proxy, running `apt-get` non-interactively.
*/
async install(...packages: string[]): Promise<void> {
const todo: string[] = [];
Expand Down Expand Up @@ -41,9 +42,11 @@ export class AptService {
);
}

const execOptions = { env: { DEBIAN_FRONTEND: 'noninteractive' } };

try {
await execa('apt-get', ['-qq', 'update']);
await execa('apt-get', ['-qq', 'install', '-y', ...todo]);
await execa('apt-get', ['-qq', 'update'], execOptions);
await execa('apt-get', ['-qq', 'install', '-y', ...todo], execOptions);
} finally {
if (this.envSvc.aptProxy) {
await rm(
Expand Down
28 changes: 16 additions & 12 deletions src/cli/tools/dotnet/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,18 +196,22 @@ describe('cli/tools/dotnet/index', () => {

await expect(svc.prepare()).resolves.toBeUndefined();

expect(execaMock).toHaveBeenCalledWith('apt-get', [
'-qq',
'install',
'-y',
'libc6',
'libgcc1',
'libgssapi-krb5-2',
icu,
'libssl3',
'libstdc++6',
'zlib1g',
]);
expect(execaMock).toHaveBeenCalledWith(
'apt-get',
[
'-qq',
'install',
'-y',
'libc6',
'libgcc1',
'libgssapi-krb5-2',
icu,
'libssl3',
'libstdc++6',
'zlib1g',
],
{ env: { DEBIAN_FRONTEND: 'noninteractive' } },
);
expect(await fs.readlink(join(envSvc.userHome, '.nuget'))).toBe(
join(pathSvc.cachePath, '.nuget'),
);
Expand Down
11 changes: 5 additions & 6 deletions src/cli/tools/git/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ describe('cli/tools/git/index', () => {

await expect(svc.install('2.55.0')).resolves.toBeUndefined();

expect(execaMock).toHaveBeenCalledWith('apt-get', [
'-qq',
'install',
'-y',
'git',
]);
expect(execaMock).toHaveBeenCalledWith(
'apt-get',
['-qq', 'install', '-y', 'git'],
{ env: { DEBIAN_FRONTEND: 'noninteractive' } },
);
});

test('install: coerces a vendor version suffix', async () => {
Expand Down
1 change: 1 addition & 0 deletions src/cli/tools/php/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ describe('cli/tools/php/index', () => {
expect(execaMock).toHaveBeenCalledWith(
'apt-get',
expect.arrayContaining([zip]),
{ env: { DEBIAN_FRONTEND: 'noninteractive' } },
);
});

Expand Down
1 change: 1 addition & 0 deletions src/cli/tools/python/conan.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ describe('cli/tools/python/conan', () => {
expect(execaMock).toHaveBeenCalledWith(
'apt-get',
expect.arrayContaining(['cmake', 'gcc']),
{ env: { DEBIAN_FRONTEND: 'noninteractive' } },
);
expect(await fs.readlink(join(envSvc.userHome, '.conan2'))).toBe(
join(pathSvc.cachePath, '.conan2'),
Expand Down
Loading