Skip worker tests on node below 18

This commit is contained in:
Brian Carlson 2025-04-21 17:48:07 -05:00
parent 42d00fa9f6
commit cccda276e9
2 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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()