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

Make the test reporter's integration tests more robust across node versions #5423

Merged
merged 2 commits into from
Jun 24, 2024
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
22 changes: 16 additions & 6 deletions v-next/hardhat-node-test-reporter/integration-tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,20 @@ for (const entry of readdirSync(import.meta.dirname + "/fixture-tests")) {
}

function normalizeOutputs(output: string): string {
return output
.replace(/\(\d+ms\)/, "(Xms)")
.replaceAll("\r\n", "\n")
.replaceAll(/\(.*?:\d+:\d+\)/g, (match) => {
return match.replaceAll(path.sep, "/");
});
return (
output
// Normalize the time it took to run the test
.replace(/\(\d+ms\)/, "(Xms)")
// Normalize windows new lines
.replaceAll("\r\n", "\n")
// Normalize path separators to `/` within the (file:line:column)
// part of the stack traces
.replaceAll(/\(.*?:\d+:\d+\)/g, (match) => {
return match.replaceAll(path.sep, "/");
})
// Remove lines like `at TestHook.run (node:internal/test_runner/test:1107:18)`
.replaceAll(/at .*? \(node\:.*?:\d+:\d+\)/g, "")
// Remove lines like `at node:internal/test_runner/test:776:20`
.replaceAll(/at node\:.*?:\d+:\d+/g, "")
);
}
Loading