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

Relax "queue a task" regexp for custom tasks #872

Merged
merged 1 commit into from
Jan 10, 2025
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
2 changes: 1 addition & 1 deletion src/lib/study-algorithms.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function studyAlgorithms(specs) {
function findAnomalyInParallelStep(spec, algo, step) {
if (step.html) {
const html = normalize(step.html);
if (html.match(/queu(e|ing) an?( \w+){0,2} (micro)?task/i)) {
if (html.match(/queu(e|ing) an?( \w+){0,3} (micro)?task/i)) {
return false;
}
if (html.match(/(^|>| )(resolve|reject)(<| )/i) &&
Expand Down
19 changes: 19 additions & 0 deletions test/study-algorithms.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,23 @@ describe('The algorithms analyser', () => {
spec: { url: 'https://www.w3.org/TR/spec' }
});
});

it('reports no anomaly when a step queues a custom task', () => {
const crawlResult = toCrawlResult([
{
html: 'The custom() method MUST run the following steps:',
rationale: 'if',
steps: [
{ html: 'Let <var>p</var> be a new promise.' },
{ html: 'In parallel',
steps: [
{ html: 'Queue a custom but fantastic task to resolve <var>p</var> with undefined' }
]
}
]
}
]);
const report = study(crawlResult);
assertNbAnomalies(report, 0);
});
});
Loading