7

My project consists of node (express), knex, objectionjs with graphql. We are using Jest to test calls to graphql which behind the scenes uses objectionjs+knex to perform updates on Postgres db.

Any jest tests calling an update to a table that has a JSON field gives the error in console:

console.error node_modules/pg/lib/index.js:52 Cannot find module 'pg-native' from 'client.js'

However, Jest was able to find:
    './client.js'

You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].

See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string

The tests complete anyway but this is an annoyance that I would like to get rid of.

Has anyone come across this issue? Let me know what additional code details I can provide to help diagnose the issue.

UPDATE: Managed to make message disappear with the workaound suggested in this post: https://github.com/sequelize/sequelize/issues/3781#issuecomment-522198459

Tiago Alcobia
  • 99
  • 1
  • 5

1 Answers1

0

Find in all files:

const { connect } = require('pg/lib/native');

And delete

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
IKress
  • 1