Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/language/markdown-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class MarkdownLanguage {
!validFrontmatterOptions.has(frontmatterOption)
) {
throw new Error(
`Invalid language option value \`${frontmatterOption}\` for frontmatter. Expected one of \`false\`, \`"yaml"\`, \`"toml"\`, or \`"json"\`.`,
`Invalid language option value \`${String(frontmatterOption)}\` for frontmatter. Expected one of \`false\`, \`"yaml"\`, \`"toml"\`, or \`"json"\`.`,
);
}

Expand All @@ -194,7 +194,7 @@ export class MarkdownLanguage {

if (mathOption !== undefined && typeof mathOption !== "boolean") {
throw new Error(
`Invalid language option value \`${mathOption}\` for math. Expected a boolean.`,
`Invalid language option value \`${String(mathOption)}\` for math. Expected a boolean.`,
);
}
}
Expand Down
22 changes: 22 additions & 0 deletions tests/language/markdown-language.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ describe("MarkdownLanguage", () => {
'Invalid language option value `123` for frontmatter. Expected one of `false`, `"yaml"`, `"toml"`, or `"json"`.',
},
);
assert.throws(
() => {
language.validateLanguageOptions({
frontmatter: Symbol("frontmatter"),
});
},
{
message:
'Invalid language option value `Symbol(frontmatter)` for frontmatter. Expected one of `false`, `"yaml"`, `"toml"`, or `"json"`.',
},
);
});

it("should not throw an error when `frontmatter` has a correct value in commonmark mode", () => {
Expand Down Expand Up @@ -116,6 +127,17 @@ describe("MarkdownLanguage", () => {
"Invalid language option value `123` for math. Expected a boolean.",
},
);
assert.throws(
() => {
language.validateLanguageOptions({
math: Symbol("math"),
});
},
{
message:
"Invalid language option value `Symbol(math)` for math. Expected a boolean.",
},
);
});

it("should not throw an error when `math` has a correct value in commonmark mode", () => {
Expand Down