diff --git a/tools/challenge-helper-scripts/helpers/project-metadata.test.ts b/tools/challenge-helper-scripts/helpers/project-metadata.test.ts index d7cd0d7c994..cf6bd25e2d5 100644 --- a/tools/challenge-helper-scripts/helpers/project-metadata.test.ts +++ b/tools/challenge-helper-scripts/helpers/project-metadata.test.ts @@ -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. +` ); }); diff --git a/tools/challenge-helper-scripts/helpers/project-metadata.ts b/tools/challenge-helper-scripts/helpers/project-metadata.ts index 8e79c10a9f1..dbdc0ab9c1d 100644 --- a/tools/challenge-helper-scripts/helpers/project-metadata.ts +++ b/tools/challenge-helper-scripts/helpers/project-metadata.ts @@ -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