Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

add tests for issue 1889#6

Merged
sideshowbarker merged 1 commit intovalidator:masterfrom
tenzap:tests-1889
Oct 15, 2025
Merged

add tests for issue 1889#6
sideshowbarker merged 1 commit intovalidator:masterfrom
tenzap:tests-1889

Conversation

@tenzap
Copy link
Copy Markdown
Contributor

@tenzap tenzap commented Oct 15, 2025

These tests work as expected when validator/validator@ff0c83e is not applied.

Once validator/validator#1890 is fixed, the message is slightly changed and has to be updated:

/path/to/vnu/tests/issues/1889-importmap-1-empty-json-novalid.html
"file:/path/to/vnu/tests/issues/1889-importmap-1-empty-json-novalid.html": error: Expected ""A “script” element with a “type” attribute whose value is “importmap” must contain a JSON object."" but instead encountered "A script “script” with a “type” attribute whose value is “importmap” must have valid JSON content.".

@tenzap
Copy link
Copy Markdown
Contributor Author

tenzap commented Oct 15, 2025

That's the patch to apply once the other PR is merge.

--- a/tests/messages.json
+++ b/tests/messages.json
@@ -2404,7 +2404,7 @@
     "html/parser/ufffe-charref-novalid.html": "Character reference expands to a non-character (U+fffe).",
     "html/parser/unassigned-charref-novalid.html": "Character reference expands to a permanently unassigned code point.",
     "issues/1889-importmap-0-not-json-novalid.html": "A script \u201cscript\u201d with a \u201ctype\u201d attribute whose value is \u201cimportmap\u201d must have valid JSON content.",
-    "issues/1889-importmap-1-empty-json-novalid.html": "A \u201cscript\u201d element with a \u201ctype\u201d attribute whose value is \u201cimportmap\u201d must contain a JSON object.",
+    "issues/1889-importmap-1-empty-json-novalid.html": "A script \u201cscript\u201d with a \u201ctype\u201d attribute whose value is \u201cimportmap\u201d must have valid JSON content.",
     "issues/1889-importmap-2-forbidden-property-novalid.html": "A \u201cscript\u201d element with a \u201ctype\u201d attribute whose value is \u201cimportmap\u201d must contain a JSON object with no properties other than \u201cimports\u201d and \u201cscopes\u201d.",
     "issues/1889-importmap-imports-empty-key-novalid.html": "A specifier map defined in a \u201cimports\u201d property within the content of a \u201cscript\u201d element with a \u201ctype\u201d attribute whose value is \u201cimportmap\u201d must only contain non-empty keys.",
     "issues/1889-importmap-imports-no-json-object-in-property-novalid.html": "The value of the \u201cimports\u201d property within the content of a \u201cscript\u201d element with a \u201ctype\u201d attribute whose value is \u201cimportmap\u201d must be a JSON object.",

@sideshowbarker
Copy link
Copy Markdown
Member

In trying to test this, I’m finding that I no longer get what’s expected when I run this:

java  -cp ../build/dist/vnu.jar nu.validator.client.TestRunner	 --ignore=html-its --write-messages messages.json

Specifically, I end up with with a messages.json file that contains a completely empty JSON object:

$ cat messages.json
{}

However, when I switch my local validator clone to a commit prior to validator/validator@ff0c83e and rebuild it and try, I get a non-empty messages.json file as expected.

So, it seems like the unexpected empty messages.json file is a result of the JSON library change.

Any clues about how to troubleshoot that and fix it?

No Java error messages are emitted in my local shell environment when I end up with that empty messages.json file. So nothing is failing — the operation succeeds but just doesn’t produce the expected result.

Given that, I guess I most likely have some condition in my existing code that fails because it’s based on some assumption about the what the JSON data should look like — but it now looks different due to the underlying library change.

@tenzap
Copy link
Copy Markdown
Contributor Author

tenzap commented Oct 15, 2025

See validator/validator#1891

@sideshowbarker sideshowbarker merged commit 5f1d6b6 into validator:master Oct 15, 2025
@tenzap tenzap deleted the tests-1889 branch October 15, 2025 10:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants