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

chore(test): Use finished to check streams #462

Merged
merged 10 commits into from Mar 22, 2022
Merged

chore(test): Use finished to check streams #462

merged 10 commits into from Mar 22, 2022

Conversation

fb55
Copy link
Collaborator

@fb55 fb55 commented Mar 16, 2022

The finish event doesn't actually fire every time a stream ends. This was already discovered in #432. This PR cleans up all other call locations.

Also switches us to using promises instead of callbacks for these tests. This has the advantage that errors will actually be reported by the test runner, instead of being uncaught inside a hanging test.

@@ -18,18 +18,16 @@ async function main() {
maxMemUsage = Math.max(maxMemUsage, stats.used_heap_size);
});

const statsPromise = new Promise((resolve) => memwatch.once('stats', resolve));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This event was updated to use the promise constructor, which allowed us to get rid of promisify-event.

@@ -21,7 +22,7 @@ global.upstreamParser = parse5Upstream;
global.hugePage = readFileSync(hugePagePath).toString();

// Micro data
global.microTests = loadTreeConstructionTestData([treeConstructionPath], treeAdapters.default)
global.microTests = loadTreeConstructionTestData(treeConstructionPath, treeAdapters.default)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The perf benchmark was broken, as I forgot to update this call site to loadTreeConstructionTestData when changing the argument to a URL.

@fb55 fb55 changed the title refactor: Use finished to check streams chore(test): Use finished to check streams Mar 17, 2022
Copy link
Collaborator

@wooorm wooorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m abstaining as I don’t feel qualified to review this :)

@fb55
Copy link
Collaborator Author

fb55 commented Mar 22, 2022

I’m abstaining as I don’t feel qualified to review this :)

No worries — as this only relates to tests, I'm feeling quite confident in the changes and will go ahead with things.

@fb55 fb55 merged commit 7438303 into master Mar 22, 2022
@fb55 fb55 deleted the finished branch March 22, 2022 12:42
jmbpwtw pushed a commit to jmbpwtw/parse5 that referenced this pull request Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants