mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 19:59:37 +00:00
Remove unit tests as requested in PR feedback
Co-authored-by: mjbvz <12821956+mjbvz@users.noreply.github.com>
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import { ImplicitProjectConfiguration } from '../../configuration/configuration';
|
||||
|
||||
suite('ImplicitProjectConfiguration', () => {
|
||||
|
||||
test('should default strict to true', () => {
|
||||
const mockConfiguration = {
|
||||
get: <T>(key: string, defaultValue?: T): T => {
|
||||
// Return default values for all settings except when explicitly overridden
|
||||
if (key === 'js/ts.implicitProjectConfig.strict') {
|
||||
return (true as any) as T;
|
||||
}
|
||||
return defaultValue as T;
|
||||
}
|
||||
} as any;
|
||||
|
||||
const config = new ImplicitProjectConfiguration(mockConfiguration);
|
||||
assert.strictEqual(config.strict, true);
|
||||
});
|
||||
|
||||
test('should respect user setting for strict', () => {
|
||||
const mockConfiguration = {
|
||||
get: <T>(key: string, defaultValue?: T): T => {
|
||||
if (key === 'js/ts.implicitProjectConfig.strict') {
|
||||
return (false as any) as T;
|
||||
}
|
||||
return defaultValue as T;
|
||||
}
|
||||
} as any;
|
||||
|
||||
const config = new ImplicitProjectConfiguration(mockConfiguration);
|
||||
assert.strictEqual(config.strict, false);
|
||||
});
|
||||
|
||||
test('should include strict in equality comparison', () => {
|
||||
const mockConfigurationTrue = {
|
||||
get: <T>(key: string, defaultValue?: T): T => {
|
||||
if (key === 'js/ts.implicitProjectConfig.strict') {
|
||||
return (true as any) as T;
|
||||
}
|
||||
return defaultValue as T;
|
||||
}
|
||||
} as any;
|
||||
|
||||
const mockConfigurationFalse = {
|
||||
get: <T>(key: string, defaultValue?: T): T => {
|
||||
if (key === 'js/ts.implicitProjectConfig.strict') {
|
||||
return (false as any) as T;
|
||||
}
|
||||
return defaultValue as T;
|
||||
}
|
||||
} as any;
|
||||
|
||||
const configTrue1 = new ImplicitProjectConfiguration(mockConfigurationTrue);
|
||||
const configTrue2 = new ImplicitProjectConfiguration(mockConfigurationTrue);
|
||||
const configFalse = new ImplicitProjectConfiguration(mockConfigurationFalse);
|
||||
|
||||
assert.strictEqual(configTrue1.isEqualTo(configTrue2), true);
|
||||
assert.strictEqual(configTrue1.isEqualTo(configFalse), false);
|
||||
});
|
||||
});
|
||||
@@ -1,55 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import { ImplicitProjectConfiguration } from '../../configuration/configuration';
|
||||
import { API } from '../../tsServer/api';
|
||||
import { inferredProjectCompilerOptions, ProjectType } from '../../tsconfig';
|
||||
|
||||
suite('inferredProjectCompilerOptions', () => {
|
||||
|
||||
function createMockServiceConfig(strictValue: boolean) {
|
||||
const mockConfiguration = {
|
||||
get: <T>(key: string, defaultValue?: T): T => {
|
||||
if (key === 'js/ts.implicitProjectConfig.strict') {
|
||||
return (strictValue as any) as T;
|
||||
}
|
||||
return defaultValue as T;
|
||||
}
|
||||
} as any;
|
||||
|
||||
return {
|
||||
implicitProjectConfiguration: new ImplicitProjectConfiguration(mockConfiguration)
|
||||
} as any;
|
||||
}
|
||||
|
||||
test('should include strict: true when setting is enabled', () => {
|
||||
const serviceConfig = createMockServiceConfig(true);
|
||||
const version = API.fromVersionString('4.0.0');
|
||||
|
||||
const options = inferredProjectCompilerOptions(version, ProjectType.TypeScript, serviceConfig);
|
||||
|
||||
assert.strictEqual(options.strict, true);
|
||||
});
|
||||
|
||||
test('should not include strict when setting is disabled', () => {
|
||||
const serviceConfig = createMockServiceConfig(false);
|
||||
const version = API.fromVersionString('4.0.0');
|
||||
|
||||
const options = inferredProjectCompilerOptions(version, ProjectType.TypeScript, serviceConfig);
|
||||
|
||||
assert.strictEqual(options.strict, undefined);
|
||||
});
|
||||
|
||||
test('should work for JavaScript projects', () => {
|
||||
const serviceConfig = createMockServiceConfig(true);
|
||||
const version = API.fromVersionString('4.0.0');
|
||||
|
||||
const options = inferredProjectCompilerOptions(version, ProjectType.JavaScript, serviceConfig);
|
||||
|
||||
assert.strictEqual(options.strict, true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user