Fix missing arg warning in tests (#820)
This commit is contained in:
parent
27fdd1b6e6
commit
10b52ac4e8
|
@ -83,28 +83,28 @@ describe('loadCliConfig', () => {
|
|||
it('should set showMemoryUsage to true when --memory flag is present', async () => {
|
||||
process.argv = ['node', 'script.js', '--show_memory_usage'];
|
||||
const settings: Settings = {};
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getShowMemoryUsage()).toBe(true);
|
||||
});
|
||||
|
||||
it('should set showMemoryUsage to false when --memory flag is not present', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const settings: Settings = {};
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getShowMemoryUsage()).toBe(false);
|
||||
});
|
||||
|
||||
it('should set showMemoryUsage to false by default from settings if CLI flag is not present', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const settings: Settings = { showMemoryUsage: false };
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getShowMemoryUsage()).toBe(false);
|
||||
});
|
||||
|
||||
it('should prioritize CLI flag over settings for showMemoryUsage (CLI true, settings false)', async () => {
|
||||
process.argv = ['node', 'script.js', '--show_memory_usage'];
|
||||
const settings: Settings = { showMemoryUsage: false };
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getShowMemoryUsage()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
@ -128,49 +128,49 @@ describe('loadCliConfig telemetry', () => {
|
|||
it('should set telemetry to false by default when no flag or setting is present', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const settings: Settings = {};
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getTelemetry()).toBe(false);
|
||||
});
|
||||
|
||||
it('should set telemetry to true when --telemetry flag is present', async () => {
|
||||
process.argv = ['node', 'script.js', '--telemetry'];
|
||||
const settings: Settings = {};
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getTelemetry()).toBe(true);
|
||||
});
|
||||
|
||||
it('should set telemetry to false when --no-telemetry flag is present', async () => {
|
||||
process.argv = ['node', 'script.js', '--no-telemetry'];
|
||||
const settings: Settings = {};
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getTelemetry()).toBe(false);
|
||||
});
|
||||
|
||||
it('should use telemetry value from settings if CLI flag is not present (settings true)', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const settings: Settings = { telemetry: true };
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getTelemetry()).toBe(true);
|
||||
});
|
||||
|
||||
it('should use telemetry value from settings if CLI flag is not present (settings false)', async () => {
|
||||
process.argv = ['node', 'script.js'];
|
||||
const settings: Settings = { telemetry: false };
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getTelemetry()).toBe(false);
|
||||
});
|
||||
|
||||
it('should prioritize --telemetry CLI flag (true) over settings (false)', async () => {
|
||||
process.argv = ['node', 'script.js', '--telemetry'];
|
||||
const settings: Settings = { telemetry: false };
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getTelemetry()).toBe(true);
|
||||
});
|
||||
|
||||
it('should prioritize --no-telemetry CLI flag (false) over settings (true)', async () => {
|
||||
process.argv = ['node', 'script.js', '--no-telemetry'];
|
||||
const settings: Settings = { telemetry: true };
|
||||
const config = await loadCliConfig(settings);
|
||||
const config = await loadCliConfig(settings, []);
|
||||
expect(config.getTelemetry()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue