Skip to content

Commit 77236ef

Browse files
authored
Merge pull request #489 from conda-incubator/perf/direct-condarc-write
2 parents 4ee756a + 36bff15 commit 77236ef

8 files changed

Lines changed: 803 additions & 628 deletions

File tree

‎dist/setup/index.js‎

Lines changed: 188 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/__tests__/base-tools/index.test.ts‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import type * as types from "../../types";
55
// Mock @actions/core
66
const mockInfo = vi.fn();
77
vi.mock("@actions/core", () => ({
8-
info: (...args: any[]) => mockInfo(...args),
8+
info: (...args: unknown[]) => mockInfo(...args),
99
warning: vi.fn(),
1010
}));
1111

1212
// Mock conda
1313
const mockCondaCommand = vi.fn(async () => {});
14-
const mockApplyCondaConfiguration = vi.fn(async () => {});
1514

1615
// Mock utils
1716
vi.mock("../../utils", () => ({
@@ -46,9 +45,7 @@ vi.mock("../../constants", () => ({
4645

4746
// Mock conda functions used by update-mamba's postInstall
4847
vi.mock("../../conda", async () => ({
49-
condaCommand: (...args: any[]) => mockCondaCommand(...args),
50-
applyCondaConfiguration: (...args: any[]) =>
51-
mockApplyCondaConfiguration(...args),
48+
condaCommand: (...args: unknown[]) => mockCondaCommand(...args),
5249
condaExecutable: vi.fn(() => "/opt/conda/bin/mamba"),
5350
condaBasePath: vi.fn(() => "/opt/conda"),
5451
}));
@@ -118,7 +115,6 @@ describe("installBaseTools", () => {
118115
beforeEach(async () => {
119116
vi.resetModules();
120117
mockCondaCommand.mockReset();
121-
mockApplyCondaConfiguration.mockReset();
122118
mockInfo.mockReset();
123119
const mod = await import("../../base-tools/index");
124120
installBaseTools = mod.installBaseTools;
@@ -131,7 +127,6 @@ describe("installBaseTools", () => {
131127
await installBaseTools(inputs, options);
132128

133129
expect(mockCondaCommand).not.toHaveBeenCalled();
134-
expect(mockApplyCondaConfiguration).not.toHaveBeenCalled();
135130
expect(mockInfo).toHaveBeenCalledWith(
136131
"No tools were installed in 'base' env.",
137132
);
@@ -151,18 +146,13 @@ describe("installBaseTools", () => {
151146
);
152147
});
153148

154-
it("calls applyCondaConfiguration with reapply=true after install", async () => {
149+
it("does not call applyCondaConfiguration (config is written upfront)", async () => {
155150
const inputs = makeInputs({ condaVersion: "23.1.0" });
156151
const options = makeOptions();
157152

158153
await installBaseTools(inputs, options);
159154

160-
expect(mockApplyCondaConfiguration).toHaveBeenCalledTimes(1);
161-
expect(mockApplyCondaConfiguration).toHaveBeenCalledWith(
162-
inputs,
163-
expect.any(Object),
164-
true,
165-
);
155+
expect(mockCondaCommand).toHaveBeenCalledTimes(1);
166156
});
167157

168158
it("installs multiple tools in a single conda command", async () => {

0 commit comments

Comments
 (0)