Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint for tests with link rel=match and testharness.js #46058

Closed
gsnedders opened this issue May 3, 2024 · 0 comments · Fixed by #46120
Closed

lint for tests with link rel=match and testharness.js #46058

gsnedders opened this issue May 3, 2024 · 0 comments · Fixed by #46120
Labels

Comments

@gsnedders
Copy link
Member

WebKit/WebKit#28071 showed up that we have a number of tests with both <script src=testharness.js> and <link rel=match>, which we should probably have a lint for.

wpt/tools/lint/lint.py

Lines 451 to 469 in c5ced76

testharnessreport_nodes: List[ElementTree.Element] = []
if source_file.testharness_nodes:
test_type = source_file.manifest_items()[0]
if test_type not in ("testharness", "manual"):
errors.append(rules.TestharnessInOtherType.error(path, (test_type,)))
if len(source_file.testharness_nodes) > 1:
errors.append(rules.MultipleTestharness.error(path))
testharnessreport_nodes = source_file.root.findall(".//{http://www.w3.org/1999/xhtml}script[@src='/resources/testharnessreport.js']")
if not testharnessreport_nodes:
errors.append(rules.MissingTestharnessReport.error(path))
else:
if len(testharnessreport_nodes) > 1:
errors.append(rules.MultipleTestharnessReport.error(path))
required_elements.extend(key for key, value in {"testharness": True,
"testharnessreport": len(testharnessreport_nodes) > 0,
"timeout": len(source_file.timeout_nodes) > 0}.items()
if value)
looks like it might be intended to lint for this, but if the testharness test type wins out (which it does!) then you don't get a lint error in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant