Ashwani Panwar
Ashwani Panwar

Reputation: 4568

TypeError: PgMock2 is not a constructor

I am working on mocking pg query, I found a npm package PGMock2 and that suggested importing like

import PgMock2 from 'pgmock2';
const pg = new PgMock2();

By using above, I am getting error TypeError: PgMock2 is not a constructor. Any idea ?

Upvotes: 0

Views: 154

Answers (1)

Ashwani Panwar
Ashwani Panwar

Reputation: 4568

I tried to console PgMock2 and found PgMock2 that I need to do PgMock2.default() and then it worked. Documentation was missing it.

Upvotes: 1

Related Questions