Fix broken tests

This commit is contained in:
Brian Carlson 2025-04-21 12:32:44 -05:00
parent c484282ace
commit 739308463d
7 changed files with 18 additions and 42 deletions

View File

@ -10,7 +10,7 @@
"packages/*"
],
"scripts": {
"test": "yarn lerna exec yarn test",
"test": "yarn lerna exec --concurrency 1 yarn test",
"build": "tsc --build",
"build:watch": "tsc --build --watch",
"docs:build": "cd docs && yarn build",

View File

@ -2,7 +2,7 @@
"name": "pg-cloudflare",
"version": "1.1.1",
"description": "A socket implementation that can run on Cloudflare Workers using native TCP connections.",
"main": "dist/empty.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "MIT",
"devDependencies": {
@ -11,9 +11,9 @@
},
"exports": {
".": {
"import": "./esm/index.js",
"require": "./dist/empty.js",
"default": "./dist/empty.js"
"import": "./esm/worker.js",
"require": "./dist/index.js",
"default": "./dist/index.js"
},
"./worker": {
"import": "./esm/worker.js",

View File

@ -1,6 +1,7 @@
'use strict'
const Result = require('pg/lib/result.js')
const prepare = require('pg/lib/utils.js').prepareValue
const pg = require('pg')
const { Result, utils } = pg
const prepare = utils.prepareValue
const EventEmitter = require('events').EventEmitter
const util = require('util')

View File

@ -39,7 +39,7 @@
"expect.js": "0.3.1",
"lodash": "^4.17.11",
"mocha": "^10.5.2",
"pg-cursor": "^1.3.0"
"pg-cursor": "2.13.1"
},
"peerDependencies": {
"pg": ">=8.0"

View File

@ -3,6 +3,8 @@
var Client = require('./client')
var defaults = require('./defaults')
var Connection = require('./connection')
var Result = require('./result')
var utils = require('./utils')
var Pool = require('pg-pool')
const { DatabaseError } = require('pg-protocol')
const { escapeIdentifier, escapeLiteral } = require('./utils')
@ -26,6 +28,8 @@ var PG = function (clientConstructor) {
this.DatabaseError = DatabaseError
this.escapeIdentifier = escapeIdentifier
this.escapeLiteral = escapeLiteral
this.Result = Result
this.utils = utils
}
if (typeof process.env.NODE_PG_FORCE_NATIVE !== 'undefined') {

View File

@ -24,7 +24,8 @@ async function test() {
})
try {
const resp = await worker.fetch('/')
const { rows } = await resp.json()
const res = await resp.json()
const { rows } = res
assert.same(rows[0].text, 'Hello, World!')
} finally {
await worker.stop()

View File

@ -5728,11 +5728,6 @@ pg-copy-streams@0.3.0:
resolved "https://registry.npmjs.org/pg-copy-streams/-/pg-copy-streams-0.3.0.tgz"
integrity sha1-pPvCo7eI1Onab3fOs1Qi2NcEO38=
pg-cursor@^1.3.0:
version "1.3.0"
resolved "https://registry.npmjs.org/pg-cursor/-/pg-cursor-1.3.0.tgz"
integrity sha1-siDxkIl2t7QNqjc8etpfyoI6sNk=
pg-int8@1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz"
@ -6713,7 +6708,7 @@ stream-spec@~0.3.5:
dependencies:
macgyver "~1.10"
"string-width-cjs@npm:string-width@^4.2.0":
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@ -6748,15 +6743,6 @@ string-width@^3.0.0, string-width@^3.1.0:
is-fullwidth-code-point "^2.0.0"
strip-ansi "^5.1.0"
string-width@^4.1.0, string-width@^4.2.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"
string-width@^5.0.1, string-width@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
@ -6796,7 +6782,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@ -6824,13 +6810,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"
strip-ansi@^7.0.1:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
@ -7478,7 +7457,7 @@ wrangler@3.58.0:
optionalDependencies:
fsevents "~2.3.2"
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@ -7496,15 +7475,6 @@ wrap-ansi@^5.1.0:
string-width "^3.0.0"
strip-ansi "^5.0.0"
wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"