Skip to content

Commit 287728b

Browse files
committed
fix: flakly integration test
1 parent f72010f commit 287728b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/pg/test/integration/client/txstatus-tests.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ suite.test('txStatus error state', function (done) {
5353
client.query('INVALID SQL SYNTAX', function (err) {
5454
assert(err, 'should receive error from invalid query')
5555

56-
// Use setImmediate to allow ReadyForQuery message to be processed
57-
setImmediate(function () {
56+
// Issue a sync query to ensure ReadyForQuery has been processed
57+
// This guarantees _txStatus has been updated
58+
client.query('SELECT 1', function () {
59+
// This callback fires after ReadyForQuery is processed
5860
assert.equal(client._txStatus, 'E', 'should be in error state')
5961

6062
// Rollback to recover

0 commit comments

Comments
 (0)