From cccda276e936222dd4cc12479b5b3499102285cf Mon Sep 17 00:00:00 2001 From: Brian Carlson Date: Mon, 21 Apr 2025 17:48:07 -0500 Subject: [PATCH] Skip worker tests on node below 18 --- packages/pg/Makefile | 10 ++++++++-- packages/pg/test/cloudflare/vitest-cf.test.ts | 1 - 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/pg/Makefile b/packages/pg/Makefile index 7f4aebfa..5575acfd 100644 --- a/packages/pg/Makefile +++ b/packages/pg/Makefile @@ -54,5 +54,11 @@ test-pool: @find test/integration/connection-pool -name "*.js" | $(node-command) binary test-worker: - @echo "***Testing Cloudflare Worker support***" - yarn vitest run -c test/vitest.config.mts test/cloudflare/ --no-watch -- $(params) + # this command only runs in node 18.x and above since there are + # worker specific items missing from the node environment in lower versions + @if [[ $(shell node --version | sed 's/v//' | cut -d'.' -f1) -ge 18 ]]; then \ + echo "***Testing Cloudflare Worker support***"; \ + yarn vitest run -c test/vitest.config.mts test/cloudflare/ --no-watch -- $(params); \ + else \ + echo "Skipping test-worker: Node.js version is less than 18."; \ + fi diff --git a/packages/pg/test/cloudflare/vitest-cf.test.ts b/packages/pg/test/cloudflare/vitest-cf.test.ts index 3f2f8adb..177f0aed 100644 --- a/packages/pg/test/cloudflare/vitest-cf.test.ts +++ b/packages/pg/test/cloudflare/vitest-cf.test.ts @@ -5,7 +5,6 @@ import args from '../cli' test('default', async () => { const pool = new Pool(args) - const result = await pool.query('SELECT $1::text as name', ['cloudflare']) assert(result.rows[0].name === 'cloudflare') pool.end()