-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Getting MockClient memory leak log #22
Comments
I have total 13 |
By trackers.on do you mean the tracker that the lib comes with or something else? Can you share small code snippet ? |
This is how I use it. Since we dont have test('Name ', async () => {
const response = [
response of 1st query, response of 2nd query
];
const trx = await knexObj.transaction();
const a = new A();
let step = 0;
tracker.on
.any(({ method, sql, bindings }: RawQuery) => {
if (step === 0) {
expect(method).toEqual('select');
expect(sql).toMatchInlineSnapshot(....);
expect(bindings).toEqual([...]);
}
step++;
return true;
})
.response(() => {
return response[step - 1];
});
await a.b(trx)
await trx.commit()
}); |
Tracker of this lib. |
Tracker.on is not using listeners at all |
Your tests are not written as it meant to be used :] test('Name ', async () => {
const trx = await knexObj.transaction();
const a = new A();
tracker.on.select(({ sql }) => sql.includes('table_name')).responseOnce({ id: 1, name: 'bla' });
await a.b(trx);
await trx.commit();
expect(tracker.history.select[0].sql).toContain('table_name');
}); Tracker is the one thing that you provide with the query response for a specific query type, and it contains the call history for each one of the requests. |
|
Okay! The logs in the first comment regarding listeners in MockClient do not hint any serious concerns right ? In this case, we can close the issue. |
I ran
The warnings are created from Found several issues for this on |
After running a bunch of unit-tests through jest, I get this log in the console.
I dont know if this is of any concern or it is just due to large number of parallel running
async
test functions.Thanks.
The text was updated successfully, but these errors were encountered: