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

test: Add debug log, to see why test randomly failed #628

Merged
merged 1 commit into from
Jan 27, 2025
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
12 changes: 11 additions & 1 deletion test/_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@
};
const request = mockServer.getLastRequest();
const expectedQuery = getExpectedQuery(query);
if (query !== false) expect(request.query).toEqual(expectedQuery);
if (query !== false) {
try {
expect(request.query).toEqual(expectedQuery);
} catch (err) {
// Debug log to check what was actually in request.
// It is happening that the "_batchAddRequests() works" randomly fails on CI, it can be caused by tests concurrency.
// If so we need to update how mockServer.getLastRequest() works.
console.log('Request:', request.route.path, request.route.methods, request.query);

Check warning on line 75 in test/_helper.js

View workflow job for this annotation

GitHub Actions / Lint

Unexpected console statement
throw err;
}
}
if (params !== false) expect(request.params).toEqual(params);
if (body !== false) expect(request.body).toEqual(body);
Object.entries(headers).forEach(([key, value]) => {
Expand Down
Loading