mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-25 20:48:50 +02:00
test: add test for load config
This commit is contained in:
parent
687bf09c96
commit
bf94bf96f8
6 changed files with 71 additions and 8 deletions
|
@ -10,5 +10,17 @@ module.exports = function loadConfig(siteDir, deleteCache = true) {
|
|||
if (fs.existsSync(configPath)) {
|
||||
config = require(configPath); // eslint-disable-line
|
||||
}
|
||||
|
||||
const requiredFields = [
|
||||
'title',
|
||||
'tagline',
|
||||
'organizationName',
|
||||
'projectName',
|
||||
'baseUrl'
|
||||
];
|
||||
const missingFields = requiredFields.filter(field => !config[field]);
|
||||
if (missingFields && missingFields.length > 0) {
|
||||
throw new Error(missingFields.join(', ') + ' are missing in siteConfig.js');
|
||||
}
|
||||
return config;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue