Skip to content
Merged
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
16 changes: 9 additions & 7 deletions jsonc/testdata/JSONTestSuite/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function getError<T>(

// Make sure that the JSON.parse and JSONC.parse results match.
for await (
const dirEntry of walk(fromFileUrl(new URL("./", import.meta.url)))
const dirEntry of walk(fromFileUrl(new URL("./", import.meta.url)), {
exts: [".json"],
})
) {
if (!dirEntry.isFile) {
continue;
Expand All @@ -30,12 +32,12 @@ for await (
async fn() {
const text = await Deno.readTextFile(dirEntry.path);

const [hasJsonError, jsonError, jsonResult] = getError(() => {
JSON.parse(text);
});
const [hasJsoncError, jsoncError, jsoncResult] = getError(() => {
JSONC.parse(text);
});
const [hasJsonError, jsonError, jsonResult] = getError(() =>
JSON.parse(text)
);
const [hasJsoncError, jsoncError, jsoncResult] = getError(() =>
JSONC.parse(text)
);

// If an error occurs in JSON.parse() but no error occurs in JSONC.parse(), or vice versa, an error is thrown.
if (hasJsonError !== hasJsoncError) {
Expand Down
Loading