diff --git a/test/extension.test.ts b/test/extension.test.ts index 934e2af218c..d777f8c4a99 100644 --- a/test/extension.test.ts +++ b/test/extension.test.ts @@ -5,6 +5,7 @@ import * as srcConfiguration from '../src/configuration/configuration'; import * as testConfiguration from './testConfiguration'; import * as packagejson from '../package.json'; +import { IConfiguration } from 'src/configuration/iconfiguration'; suite('package.json', () => { test('all keys have handlers', async () => { @@ -27,15 +28,40 @@ suite('package.json', () => { assert.ok(pkgConfigurations); const keys = Object.keys(pkgConfigurations); assert.notStrictEqual(keys.length, 0); + assert.ok(keys.every((key) => key.startsWith('vim.'))); + + const isUnhandled = (configuration: IConfiguration, key: string): boolean => { + const keyFirstSegment = key.split('.')[1]; // Extract the first segment without the `vim.` prefix from `key`, e.g. get `foo` from 'vim.foo.bar.baz'. + + const handlers = Object.keys(configuration); + const propertyExists = handlers.includes(keyFirstSegment); + if (propertyExists) { + return false; + } + + // If the property doesn't exist, check the possibility that the field is implemented as a get proxy by calling it. + if (configuration[keyFirstSegment]) { + return false; + } + + return true; + }; // configuration - let handlers = Object.keys(srcConfiguration.configuration); - let unhandled = keys.filter((k) => handlers.includes(k)); - assert.strictEqual(unhandled.length, 0, 'Missing src handlers for ' + unhandled.join(',')); + const srcUnhandled = keys.filter(isUnhandled.bind(null, srcConfiguration.configuration)); + assert.strictEqual( + srcUnhandled.length, + 0, + 'Missing src handlers for ' + srcUnhandled.join(','), + ); // test configuration - handlers = Object.keys(new testConfiguration.Configuration()); - unhandled = keys.filter((k) => handlers.includes(k)); - assert.strictEqual(unhandled.length, 0, 'Missing test handlers for ' + unhandled.join(',')); + const testConfigurationInstance = new testConfiguration.Configuration(); + const testUnhandled = keys.filter(isUnhandled.bind(null, testConfigurationInstance)); + assert.strictEqual( + testUnhandled.length, + 0, + 'Missing test handlers for ' + testUnhandled.join(','), + ); }); }); diff --git a/test/testConfiguration.ts b/test/testConfiguration.ts index 614976d110e..c3334e821b8 100644 --- a/test/testConfiguration.ts +++ b/test/testConfiguration.ts @@ -42,6 +42,8 @@ export class Configuration implements IConfiguration { easymotionDimBackground = true; easymotionMarkerFontWeight = 'bold'; easymotionKeys = 'hklyuiopnm,qwertzxcvbasdgjf;'; + easymotionJumpToAnywhereRegex = '\\b[A-Za-z0-9]|[A-Za-z0-9]\\b|_.|#.|[a-z][A-Z]'; + targets: ITargetsConfiguration = { enable: false, bracketObjects: {