@outputai/cli 0.1.13-dev.98dfd72.0 → 0.1.13-dev.af42b51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.js +0 -2
- package/dist/api/generated/api.d.ts +319 -85
- package/dist/api/generated/api.js +66 -8
- package/dist/assets/docker/docker-compose-dev.yml +1 -1
- package/dist/commands/fix.js +1 -1
- package/dist/commands/fix.spec.js +2 -2
- package/dist/commands/update.js +1 -1
- package/dist/commands/update.spec.js +2 -2
- package/dist/commands/workflow/plan.js +1 -5
- package/dist/commands/workflow/plan.spec.js +2 -3
- package/dist/commands/workflow/run.js +1 -2
- package/dist/commands/workflow/run.spec.js +0 -1
- package/dist/commands/workflow/start.js +1 -2
- package/dist/commands/workflow/start.spec.js +0 -1
- package/dist/generated/framework_version.json +1 -1
- package/dist/hooks/init.js +0 -4
- package/dist/services/coding_agents.js +1 -1
- package/dist/services/coding_agents.spec.js +6 -6
- package/dist/services/credentials_configurator.js +1 -1
- package/dist/services/env_configurator.js +1 -1
- package/dist/services/env_configurator.spec.js +12 -12
- package/dist/services/project_scaffold.js +2 -2
- package/dist/services/project_scaffold.spec.js +6 -6
- package/dist/services/workflow_builder.js +1 -5
- package/dist/services/workflow_builder.spec.js +2 -3
- package/dist/utils/format_workflow_result.d.ts +3 -3
- package/package.json +4 -5
- package/dist/commands/credentials/set.d.ts +0 -14
- package/dist/commands/credentials/set.js +0 -57
- package/dist/commands/credentials/set.spec.d.ts +0 -1
- package/dist/commands/credentials/set.spec.js +0 -95
- package/dist/utils/interactive.d.ts +0 -2
- package/dist/utils/interactive.js +0 -5
- package/dist/utils/interactive.spec.d.ts +0 -1
- package/dist/utils/interactive.spec.js +0 -40
- package/dist/utils/prompt.d.ts +0 -17
- package/dist/utils/prompt.js +0 -20
- package/dist/utils/prompt.spec.d.ts +0 -1
- package/dist/utils/prompt.spec.js +0 -74
- package/dist/utils/proxy.d.ts +0 -1
- package/dist/utils/proxy.js +0 -9
- package/dist/utils/proxy.spec.d.ts +0 -1
- package/dist/utils/proxy.spec.js +0 -39
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Args, Command, Flags } from '@oclif/core';
|
|
2
|
-
import { load as parseYaml, dump as stringifyYaml } from 'js-yaml';
|
|
3
|
-
import { decryptCredentials, credentialsExist, writeEncrypted, resolveCredentialsPath } from '#services/credentials_service.js';
|
|
4
|
-
const setNestedValue = (obj, dotPath, value) => {
|
|
5
|
-
const parts = dotPath.split('.');
|
|
6
|
-
const parent = parts.slice(0, -1).reduce((current, key) => {
|
|
7
|
-
if (!current[key] || typeof current[key] !== 'object') {
|
|
8
|
-
current[key] = {};
|
|
9
|
-
}
|
|
10
|
-
return current[key];
|
|
11
|
-
}, obj);
|
|
12
|
-
parent[parts[parts.length - 1]] = value;
|
|
13
|
-
};
|
|
14
|
-
export default class CredentialsSet extends Command {
|
|
15
|
-
static description = 'Set a credential value by dot-notation path';
|
|
16
|
-
static examples = [
|
|
17
|
-
'<%= config.bin %> <%= command.id %> anthropic.api_key sk-ant-...',
|
|
18
|
-
'<%= config.bin %> <%= command.id %> openai.api_key sk-... --environment production',
|
|
19
|
-
'<%= config.bin %> <%= command.id %> stripe.key sk_live_... --workflow my_workflow'
|
|
20
|
-
];
|
|
21
|
-
static args = {
|
|
22
|
-
path: Args.string({
|
|
23
|
-
description: 'Dot-notation path to the credential (e.g. anthropic.api_key)',
|
|
24
|
-
required: true
|
|
25
|
-
}),
|
|
26
|
-
value: Args.string({
|
|
27
|
-
description: 'Value to set',
|
|
28
|
-
required: true
|
|
29
|
-
})
|
|
30
|
-
};
|
|
31
|
-
static flags = {
|
|
32
|
-
environment: Flags.string({
|
|
33
|
-
char: 'e',
|
|
34
|
-
description: 'Target environment (e.g. production, development)'
|
|
35
|
-
}),
|
|
36
|
-
workflow: Flags.string({
|
|
37
|
-
char: 'w',
|
|
38
|
-
description: 'Target a specific workflow directory'
|
|
39
|
-
})
|
|
40
|
-
};
|
|
41
|
-
async run() {
|
|
42
|
-
const { args, flags } = await this.parse(CredentialsSet);
|
|
43
|
-
const environment = flags.environment;
|
|
44
|
-
const workflow = flags.workflow;
|
|
45
|
-
if (environment && workflow) {
|
|
46
|
-
this.error('Cannot specify both --environment and --workflow.');
|
|
47
|
-
}
|
|
48
|
-
if (!credentialsExist(environment, workflow)) {
|
|
49
|
-
this.error(`No credentials file found at ${resolveCredentialsPath(environment, workflow)}. Run "output credentials init" first.`);
|
|
50
|
-
}
|
|
51
|
-
const plaintext = decryptCredentials(environment, workflow);
|
|
52
|
-
const data = (parseYaml(plaintext) || {});
|
|
53
|
-
setNestedValue(data, args.path, args.value);
|
|
54
|
-
writeEncrypted(environment, stringifyYaml(data), workflow);
|
|
55
|
-
this.log(`Set ${args.path}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
3
|
-
import * as credentialsService from '#services/credentials_service.js';
|
|
4
|
-
import CredentialsSet from './set.js';
|
|
5
|
-
vi.mock('#services/credentials_service.js');
|
|
6
|
-
vi.mock('js-yaml', () => ({
|
|
7
|
-
load: vi.fn((yaml) => {
|
|
8
|
-
if (yaml.includes('sk-existing')) {
|
|
9
|
-
return { anthropic: { api_key: 'sk-existing' } };
|
|
10
|
-
}
|
|
11
|
-
return {};
|
|
12
|
-
}),
|
|
13
|
-
dump: vi.fn((obj) => JSON.stringify(obj))
|
|
14
|
-
}));
|
|
15
|
-
describe('credentials set command', () => {
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
vi.clearAllMocks();
|
|
18
|
-
vi.mocked(credentialsService.credentialsExist).mockReturnValue(true);
|
|
19
|
-
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('anthropic:\n api_key: sk-existing\n');
|
|
20
|
-
vi.mocked(credentialsService.writeEncrypted).mockImplementation(() => { });
|
|
21
|
-
});
|
|
22
|
-
afterEach(() => {
|
|
23
|
-
vi.restoreAllMocks();
|
|
24
|
-
});
|
|
25
|
-
const createTestCommand = (parsedArgs = {}, flags = {}) => {
|
|
26
|
-
const cmd = new CredentialsSet([], {});
|
|
27
|
-
cmd.log = vi.fn();
|
|
28
|
-
cmd.error = vi.fn((msg) => {
|
|
29
|
-
throw new Error(msg);
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(cmd, 'parse', {
|
|
32
|
-
value: vi.fn().mockResolvedValue({
|
|
33
|
-
args: { path: 'anthropic.api_key', value: 'sk-new-key', ...parsedArgs },
|
|
34
|
-
flags: { environment: undefined, workflow: undefined, ...flags }
|
|
35
|
-
}),
|
|
36
|
-
configurable: true
|
|
37
|
-
});
|
|
38
|
-
return cmd;
|
|
39
|
-
};
|
|
40
|
-
describe('command structure', () => {
|
|
41
|
-
it('should have correct description', () => {
|
|
42
|
-
expect(CredentialsSet.description).toContain('credential value');
|
|
43
|
-
});
|
|
44
|
-
it('should have required path and value arguments', () => {
|
|
45
|
-
expect(CredentialsSet.args.path).toBeDefined();
|
|
46
|
-
expect(CredentialsSet.args.path.required).toBe(true);
|
|
47
|
-
expect(CredentialsSet.args.value).toBeDefined();
|
|
48
|
-
expect(CredentialsSet.args.value.required).toBe(true);
|
|
49
|
-
});
|
|
50
|
-
it('should have environment and workflow flags', () => {
|
|
51
|
-
expect(CredentialsSet.flags.environment).toBeDefined();
|
|
52
|
-
expect(CredentialsSet.flags.workflow).toBeDefined();
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
describe('command execution', () => {
|
|
56
|
-
it('should decrypt, update, and re-encrypt credentials', async () => {
|
|
57
|
-
const cmd = createTestCommand();
|
|
58
|
-
await cmd.run();
|
|
59
|
-
expect(credentialsService.decryptCredentials).toHaveBeenCalledWith(undefined, undefined);
|
|
60
|
-
expect(credentialsService.writeEncrypted).toHaveBeenCalledWith(undefined, expect.any(String), undefined);
|
|
61
|
-
expect(cmd.log).toHaveBeenCalledWith('Set anthropic.api_key');
|
|
62
|
-
});
|
|
63
|
-
it('should create nested keys that do not exist', async () => {
|
|
64
|
-
vi.mocked(credentialsService.decryptCredentials).mockReturnValue('');
|
|
65
|
-
const cmd = createTestCommand({ path: 'new.nested.key', value: 'my-value' });
|
|
66
|
-
await cmd.run();
|
|
67
|
-
expect(credentialsService.writeEncrypted).toHaveBeenCalledTimes(1);
|
|
68
|
-
expect(cmd.log).toHaveBeenCalledWith('Set new.nested.key');
|
|
69
|
-
});
|
|
70
|
-
it('should pass environment flag to service functions', async () => {
|
|
71
|
-
const cmd = createTestCommand({}, { environment: 'production' });
|
|
72
|
-
await cmd.run();
|
|
73
|
-
expect(credentialsService.credentialsExist).toHaveBeenCalledWith('production', undefined);
|
|
74
|
-
expect(credentialsService.decryptCredentials).toHaveBeenCalledWith('production', undefined);
|
|
75
|
-
expect(credentialsService.writeEncrypted).toHaveBeenCalledWith('production', expect.any(String), undefined);
|
|
76
|
-
});
|
|
77
|
-
it('should pass workflow flag to service functions', async () => {
|
|
78
|
-
const cmd = createTestCommand({}, { workflow: 'my_workflow' });
|
|
79
|
-
await cmd.run();
|
|
80
|
-
expect(credentialsService.credentialsExist).toHaveBeenCalledWith(undefined, 'my_workflow');
|
|
81
|
-
expect(credentialsService.decryptCredentials).toHaveBeenCalledWith(undefined, 'my_workflow');
|
|
82
|
-
expect(credentialsService.writeEncrypted).toHaveBeenCalledWith(undefined, expect.any(String), 'my_workflow');
|
|
83
|
-
});
|
|
84
|
-
it('should error when both environment and workflow are specified', async () => {
|
|
85
|
-
const cmd = createTestCommand({}, { environment: 'production', workflow: 'my_workflow' });
|
|
86
|
-
await expect(cmd.run()).rejects.toThrow('Cannot specify both');
|
|
87
|
-
});
|
|
88
|
-
it('should error when credentials file does not exist', async () => {
|
|
89
|
-
vi.mocked(credentialsService.credentialsExist).mockReturnValue(false);
|
|
90
|
-
vi.mocked(credentialsService.resolveCredentialsPath).mockReturnValue('/project/config/credentials.yml.enc');
|
|
91
|
-
const cmd = createTestCommand();
|
|
92
|
-
await expect(cmd.run()).rejects.toThrow('No credentials file found');
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
-
describe('interactive', () => {
|
|
3
|
-
beforeEach(async () => {
|
|
4
|
-
// Re-import to reset singleton state
|
|
5
|
-
const mod = await import('./interactive.js');
|
|
6
|
-
mod.setNonInteractive(false);
|
|
7
|
-
});
|
|
8
|
-
it('isInteractive returns true by default when TTY is available', async () => {
|
|
9
|
-
const originalIsTTY = process.stdin.isTTY;
|
|
10
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: true, configurable: true });
|
|
11
|
-
const { isInteractive } = await import('./interactive.js');
|
|
12
|
-
expect(isInteractive()).toBe(true);
|
|
13
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: originalIsTTY, configurable: true });
|
|
14
|
-
});
|
|
15
|
-
it('isInteractive returns false when no TTY', async () => {
|
|
16
|
-
const originalIsTTY = process.stdin.isTTY;
|
|
17
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: undefined, configurable: true });
|
|
18
|
-
const { isInteractive } = await import('./interactive.js');
|
|
19
|
-
expect(isInteractive()).toBe(false);
|
|
20
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: originalIsTTY, configurable: true });
|
|
21
|
-
});
|
|
22
|
-
it('isInteractive returns false after setNonInteractive(true)', async () => {
|
|
23
|
-
const originalIsTTY = process.stdin.isTTY;
|
|
24
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: true, configurable: true });
|
|
25
|
-
const { isInteractive, setNonInteractive } = await import('./interactive.js');
|
|
26
|
-
setNonInteractive(true);
|
|
27
|
-
expect(isInteractive()).toBe(false);
|
|
28
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: originalIsTTY, configurable: true });
|
|
29
|
-
});
|
|
30
|
-
it('setNonInteractive(false) restores interactive mode', async () => {
|
|
31
|
-
const originalIsTTY = process.stdin.isTTY;
|
|
32
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: true, configurable: true });
|
|
33
|
-
const { isInteractive, setNonInteractive } = await import('./interactive.js');
|
|
34
|
-
setNonInteractive(true);
|
|
35
|
-
expect(isInteractive()).toBe(false);
|
|
36
|
-
setNonInteractive(false);
|
|
37
|
-
expect(isInteractive()).toBe(true);
|
|
38
|
-
Object.defineProperty(process.stdin, 'isTTY', { value: originalIsTTY, configurable: true });
|
|
39
|
-
});
|
|
40
|
-
});
|
package/dist/utils/prompt.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
type ConfirmOptions = {
|
|
2
|
-
message: string;
|
|
3
|
-
default?: boolean;
|
|
4
|
-
};
|
|
5
|
-
type InputOptions = {
|
|
6
|
-
message: string;
|
|
7
|
-
default?: string;
|
|
8
|
-
validate?: (value: string) => boolean | string;
|
|
9
|
-
};
|
|
10
|
-
type PasswordOptions = {
|
|
11
|
-
message: string;
|
|
12
|
-
mask?: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare const confirm: (options: ConfirmOptions) => Promise<boolean>;
|
|
15
|
-
export declare const input: (options: InputOptions) => Promise<string>;
|
|
16
|
-
export declare const password: (options: PasswordOptions) => Promise<string>;
|
|
17
|
-
export {};
|
package/dist/utils/prompt.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { confirm as inquirerConfirm, input as inquirerInput, password as inquirerPassword } from '@inquirer/prompts';
|
|
2
|
-
import { isInteractive } from './interactive.js';
|
|
3
|
-
export const confirm = async (options) => {
|
|
4
|
-
if (!isInteractive()) {
|
|
5
|
-
return options.default ?? true;
|
|
6
|
-
}
|
|
7
|
-
return inquirerConfirm(options);
|
|
8
|
-
};
|
|
9
|
-
export const input = async (options) => {
|
|
10
|
-
if (!isInteractive()) {
|
|
11
|
-
return options.default ?? '';
|
|
12
|
-
}
|
|
13
|
-
return inquirerInput(options);
|
|
14
|
-
};
|
|
15
|
-
export const password = async (options) => {
|
|
16
|
-
if (!isInteractive()) {
|
|
17
|
-
return '';
|
|
18
|
-
}
|
|
19
|
-
return inquirerPassword(options);
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { confirm as inquirerConfirm, input as inquirerInput, password as inquirerPassword } from '@inquirer/prompts';
|
|
3
|
-
vi.mock('@inquirer/prompts', () => ({
|
|
4
|
-
confirm: vi.fn(),
|
|
5
|
-
input: vi.fn(),
|
|
6
|
-
password: vi.fn()
|
|
7
|
-
}));
|
|
8
|
-
vi.mock('./interactive.js', () => ({
|
|
9
|
-
isInteractive: vi.fn()
|
|
10
|
-
}));
|
|
11
|
-
describe('prompt wrapper', () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
vi.clearAllMocks();
|
|
14
|
-
});
|
|
15
|
-
describe('when interactive', () => {
|
|
16
|
-
beforeEach(async () => {
|
|
17
|
-
const { isInteractive } = await import('./interactive.js');
|
|
18
|
-
vi.mocked(isInteractive).mockReturnValue(true);
|
|
19
|
-
});
|
|
20
|
-
it('confirm delegates to inquirer', async () => {
|
|
21
|
-
vi.mocked(inquirerConfirm).mockResolvedValue(false);
|
|
22
|
-
const { confirm } = await import('./prompt.js');
|
|
23
|
-
const result = await confirm({ message: 'Continue?', default: true });
|
|
24
|
-
expect(inquirerConfirm).toHaveBeenCalledWith({ message: 'Continue?', default: true });
|
|
25
|
-
expect(result).toBe(false);
|
|
26
|
-
});
|
|
27
|
-
it('input delegates to inquirer', async () => {
|
|
28
|
-
vi.mocked(inquirerInput).mockResolvedValue('user input');
|
|
29
|
-
const { input } = await import('./prompt.js');
|
|
30
|
-
const result = await input({ message: 'Name?', default: 'default' });
|
|
31
|
-
expect(inquirerInput).toHaveBeenCalledWith({ message: 'Name?', default: 'default' });
|
|
32
|
-
expect(result).toBe('user input');
|
|
33
|
-
});
|
|
34
|
-
it('password delegates to inquirer', async () => {
|
|
35
|
-
vi.mocked(inquirerPassword).mockResolvedValue('secret');
|
|
36
|
-
const { password } = await import('./prompt.js');
|
|
37
|
-
const result = await password({ message: 'Token?' });
|
|
38
|
-
expect(inquirerPassword).toHaveBeenCalledWith({ message: 'Token?' });
|
|
39
|
-
expect(result).toBe('secret');
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
describe('when non-interactive', () => {
|
|
43
|
-
beforeEach(async () => {
|
|
44
|
-
const { isInteractive } = await import('./interactive.js');
|
|
45
|
-
vi.mocked(isInteractive).mockReturnValue(false);
|
|
46
|
-
});
|
|
47
|
-
it('confirm returns default value', async () => {
|
|
48
|
-
const { confirm } = await import('./prompt.js');
|
|
49
|
-
expect(await confirm({ message: 'Continue?', default: false })).toBe(false);
|
|
50
|
-
expect(await confirm({ message: 'Continue?', default: true })).toBe(true);
|
|
51
|
-
expect(inquirerConfirm).not.toHaveBeenCalled();
|
|
52
|
-
});
|
|
53
|
-
it('confirm defaults to true when no default specified', async () => {
|
|
54
|
-
const { confirm } = await import('./prompt.js');
|
|
55
|
-
expect(await confirm({ message: 'Continue?' })).toBe(true);
|
|
56
|
-
expect(inquirerConfirm).not.toHaveBeenCalled();
|
|
57
|
-
});
|
|
58
|
-
it('input returns default value', async () => {
|
|
59
|
-
const { input } = await import('./prompt.js');
|
|
60
|
-
expect(await input({ message: 'Name?', default: 'fallback' })).toBe('fallback');
|
|
61
|
-
expect(inquirerInput).not.toHaveBeenCalled();
|
|
62
|
-
});
|
|
63
|
-
it('input returns empty string when no default', async () => {
|
|
64
|
-
const { input } = await import('./prompt.js');
|
|
65
|
-
expect(await input({ message: 'Name?' })).toBe('');
|
|
66
|
-
expect(inquirerInput).not.toHaveBeenCalled();
|
|
67
|
-
});
|
|
68
|
-
it('password returns empty string', async () => {
|
|
69
|
-
const { password } = await import('./prompt.js');
|
|
70
|
-
expect(await password({ message: 'Token?' })).toBe('');
|
|
71
|
-
expect(inquirerPassword).not.toHaveBeenCalled();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
});
|
package/dist/utils/proxy.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const bootstrapProxy: () => void;
|
package/dist/utils/proxy.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { EnvHttpProxyAgent, setGlobalDispatcher } from 'undici';
|
|
2
|
-
export const bootstrapProxy = () => {
|
|
3
|
-
const proxyUrl = process.env.HTTPS_PROXY || process.env.https_proxy ||
|
|
4
|
-
process.env.HTTP_PROXY || process.env.http_proxy;
|
|
5
|
-
if (!proxyUrl) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
setGlobalDispatcher(new EnvHttpProxyAgent());
|
|
9
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/utils/proxy.spec.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
const mockSetGlobalDispatcher = vi.fn();
|
|
3
|
-
const MockEnvHttpProxyAgent = vi.fn();
|
|
4
|
-
vi.mock('undici', () => ({
|
|
5
|
-
EnvHttpProxyAgent: MockEnvHttpProxyAgent,
|
|
6
|
-
setGlobalDispatcher: mockSetGlobalDispatcher
|
|
7
|
-
}));
|
|
8
|
-
describe('proxy bootstrap', () => {
|
|
9
|
-
const originalEnv = { ...process.env };
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
vi.clearAllMocks();
|
|
12
|
-
delete process.env.HTTPS_PROXY;
|
|
13
|
-
delete process.env.https_proxy;
|
|
14
|
-
delete process.env.HTTP_PROXY;
|
|
15
|
-
delete process.env.http_proxy;
|
|
16
|
-
});
|
|
17
|
-
afterEach(() => {
|
|
18
|
-
process.env = { ...originalEnv };
|
|
19
|
-
});
|
|
20
|
-
it('does nothing when no proxy env vars are set', async () => {
|
|
21
|
-
const { bootstrapProxy } = await import('./proxy.js');
|
|
22
|
-
bootstrapProxy();
|
|
23
|
-
expect(mockSetGlobalDispatcher).not.toHaveBeenCalled();
|
|
24
|
-
});
|
|
25
|
-
it('sets global dispatcher when HTTPS_PROXY is set', async () => {
|
|
26
|
-
process.env.HTTPS_PROXY = 'http://proxy:8080';
|
|
27
|
-
const { bootstrapProxy } = await import('./proxy.js');
|
|
28
|
-
bootstrapProxy();
|
|
29
|
-
expect(MockEnvHttpProxyAgent).toHaveBeenCalled();
|
|
30
|
-
expect(mockSetGlobalDispatcher).toHaveBeenCalledTimes(1);
|
|
31
|
-
});
|
|
32
|
-
it('sets global dispatcher when HTTP_PROXY is set', async () => {
|
|
33
|
-
process.env.HTTP_PROXY = 'http://proxy:8080';
|
|
34
|
-
const { bootstrapProxy } = await import('./proxy.js');
|
|
35
|
-
bootstrapProxy();
|
|
36
|
-
expect(MockEnvHttpProxyAgent).toHaveBeenCalled();
|
|
37
|
-
expect(mockSetGlobalDispatcher).toHaveBeenCalledTimes(1);
|
|
38
|
-
});
|
|
39
|
-
});
|