fix(tools): update error message for hints without tests (#64354)

Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com>
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
MeaslyDay
2025-12-10 00:20:13 -08:00
committed by GitHub
parent 6a8be7ca50
commit 2beb6c8dc6
2 changed files with 4 additions and 2 deletions
@@ -8,7 +8,9 @@ function plugin() {
function transformer(tree, file) {
const hintNodes = getSection(tree, '--hints--');
if (hintNodes.length % 2 !== 0)
throw Error('Tests must be in (text, ```testString```) order');
throw Error(
'Hints must be in pairs: each hint text followed by a test code block'
);
const tests = chunk(hintNodes, 2).map(getTest);
file.data.tests = tests;
@@ -42,7 +42,7 @@ describe('add-tests plugin', () => {
it('should throw if a test pair is out of order', () => {
// TODO: update the markdown so it makes this error
expect(() => plugin(brokenHintsAST, file)).toThrow(
'Tests must be in (text, ```testString```) order'
'Hints must be in pairs: each hint text followed by a test code block'
);
});