We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2da196c commit e8280d5Copy full SHA for e8280d5
packages/pg-esm-test/common-js-imports.test.cjs
@@ -0,0 +1,24 @@
1
+const assert = require('node:assert')
2
+const test = require('node:test')
3
+const { describe, it } = test
4
+
5
+const paths = ['pg', 'pg/lib/index.js', 'pg/lib/connection-parameters.js']
6
+for (const path of paths) {
7
+ describe(`importing ${path}`, () => {
8
+ it('works with require', () => {
9
+ const mod = require(path)
10
+ assert(mod)
11
+ })
12
13
+}
14
15
+describe('pg-native', () => {
16
+ it('should work with commonjs', async () => {
17
+ const pg = require('pg')
18
19
+ const pool = new pg.native.Pool()
20
+ const result = await pool.query('SELECT 1')
21
+ assert.strictEqual(result.rowCount, 1)
22
+ pool.end()
23
24
+})
0 commit comments