mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix: errors if challenge file needs renaming (#54130)
This commit is contained in:
committed by
GitHub
parent
a218be17b3
commit
a6140777a5
@@ -130,7 +130,14 @@ dashedName: step-3
|
||||
process.env.CALLING_DIR = projectPath;
|
||||
|
||||
expect(() => validateMetaData()).toThrow(
|
||||
`ENOENT: no such file or directory, access '${projectPath}/1.md'`
|
||||
`The file
|
||||
${projectPath}/1.md
|
||||
does not exist, but is required by the challengeOrder of
|
||||
${metaPath}/meta.json
|
||||
|
||||
To fix this, you can rename the file containing id: 1 to 1.md
|
||||
If there is no file for this id, then either the challengeOrder needs to be updated, or the file needs to be created.
|
||||
`
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -44,7 +44,21 @@ function validateMetaData(): void {
|
||||
|
||||
// each step in the challengeOrder should correspond to a file
|
||||
challengeOrder.forEach(({ id }) => {
|
||||
fs.accessSync(`${getProjectPath()}${id}.md`);
|
||||
const filePath = `${getProjectPath()}${id}.md`;
|
||||
try {
|
||||
fs.accessSync(filePath);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`The file
|
||||
${filePath}
|
||||
does not exist, but is required by the challengeOrder of
|
||||
${getProjectMetaPath()}
|
||||
|
||||
To fix this, you can rename the file containing id: ${id} to ${id}.md
|
||||
If there is no file for this id, then either the challengeOrder needs to be updated, or the file needs to be created.
|
||||
`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// each file should have a corresponding step in the challengeOrder
|
||||
|
||||
Reference in New Issue
Block a user