diff --git a/src/config.js b/src/config.js index 7ac9ebd2ed..fc18bfaf75 100644 --- a/src/config.js +++ b/src/config.js @@ -155,6 +155,8 @@ export async function discoverConfigFiles({ getHomeDir = os.homedir } = {}) { path.join(process.cwd(), 'package.json'), // Look for a magic config in the current working directory. path.join(process.cwd(), magicConfigName), + // Look for a magic hidden config (preceded by dot) the current working directory. + path.join(process.cwd(), `.${magicConfigName}`), ]; const configs = await Promise.all( diff --git a/tests/unit/test.config.js b/tests/unit/test.config.js index 5c0db86083..aa01fb8069 100644 --- a/tests/unit/test.config.js +++ b/tests/unit/test.config.js @@ -1018,7 +1018,7 @@ describe('config', () => { process.chdir(tmpDir.path()); try { const expectedConfig = path.resolve( - path.join(process.cwd(), 'web-ext-config.js'), + path.join(process.cwd(), '.web-ext-config.js'), ); await fs.writeFile(expectedConfig, 'module.exports = {}'); @@ -1054,15 +1054,25 @@ describe('config', () => { ); const projectConfig = path.resolve( - path.join(process.cwd(), 'web-ext-config.js'), + path.join(process.cwd(), '.web-ext-config.js'), ); await fs.writeFile(projectConfig, 'module.exports = {}'); + const projectConfigUndotted = path.resolve( + path.join(process.cwd(), 'web-ext-config.js'), + ); + await fs.writeFile(projectConfigUndotted, 'module.exports = {}'); + assert.deepEqual( await _discoverConfigFiles({ getHomeDir: () => fakeHomeDir, }), - [globalConfig, packageJSONConfig, projectConfig], + [ + globalConfig, + packageJSONConfig, + projectConfigUndotted, + projectConfig, + ], ); } finally { process.chdir(lastDir);