diff --git a/README.md b/README.md index 1acb158cf043..88f7da7ed8d7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The cspell mono-repo, a spell checker for code. ## Support Future Development -[![](https://github.com/streetsidesoftware/cspell/raw/master/resources/100px-Green_Patreon_Donate_Shield_Badge.png)](https://www.patreon.com/streetsidesoftware) +[![Patreon](https://github.com/streetsidesoftware/cspell/raw/master/resources/100px-Green_Patreon_Donate_Shield_Badge.png)](https://www.patreon.com/streetsidesoftware) ## Packages diff --git a/packages/cspell-lib/src/Settings/GlobalSettings.test.ts b/packages/cspell-lib/src/Settings/GlobalSettings.test.ts index 172d1a880064..09bc715878e7 100644 --- a/packages/cspell-lib/src/Settings/GlobalSettings.test.ts +++ b/packages/cspell-lib/src/Settings/GlobalSettings.test.ts @@ -31,6 +31,15 @@ describe('Validate GlobalSettings', () => { const path = getGlobalConfigPath(); const s = getRawGlobalSettings(); expect(s).toEqual({ + source: { + name: 'CSpell Configstore', + filename: undefined, + }, + }); + mockSetData('version', '0.2.0'); + const s2 = getRawGlobalSettings(); + expect(s2).toEqual({ + version: '0.2.0', source: { name: 'CSpell Configstore', filename: path, diff --git a/packages/cspell-lib/src/Settings/GlobalSettings.ts b/packages/cspell-lib/src/Settings/GlobalSettings.ts index aa5faa0f0175..b89bcdf1618f 100644 --- a/packages/cspell-lib/src/Settings/GlobalSettings.ts +++ b/packages/cspell-lib/src/Settings/GlobalSettings.ts @@ -24,11 +24,15 @@ export function getRawGlobalSettings(): GlobalSettingsWithSource { try { const cfgStore = new ConfigStore(packageName); - Object.assign(globalConf, cfgStore.all); - globalConf.source = { - name, - filename: cfgStore.path, - }; + const cfg = cfgStore.all; + // Only populate globalConf is there are values. + if (cfg && Object.keys(cfg).length) { + Object.assign(globalConf, cfg); + globalConf.source = { + name, + filename: cfgStore.path, + }; + } } catch (error) { logError(error); } diff --git a/packages/cspell-lib/src/Settings/link.test.ts b/packages/cspell-lib/src/Settings/link.test.ts index f44471e980cc..c5b996b85302 100644 --- a/packages/cspell-lib/src/Settings/link.test.ts +++ b/packages/cspell-lib/src/Settings/link.test.ts @@ -33,7 +33,7 @@ describe('Validate Link.ts', () => { expect(r).toEqual({ list: [], globalSettings: { - source: { filename: configFileLocation, name: 'CSpell Configstore' }, + source: { filename: undefined, name: 'CSpell Configstore' }, }, }); expect(mockSetData).not.toHaveBeenCalled();