From 66535ea63c43bb79f84205771993647b31d73c29 Mon Sep 17 00:00:00 2001 From: Khafra Date: Wed, 25 Oct 2023 14:23:04 -0400 Subject: [PATCH 1/3] skip bundle test on node 16 --- test/fetch/bundle.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/fetch/bundle.js b/test/fetch/bundle.js index 3b35cfc04aa..0a0de22a031 100644 --- a/test/fetch/bundle.js +++ b/test/fetch/bundle.js @@ -1,6 +1,13 @@ 'use strict' -const { test } = require('tap') +const { test, skip } = require('tap') +const { nodeMajor } = require('../../lib/core/util') + +if (nodeMajor === 16) { + skip('esbuild uses static blocks with --keep-names which node 16.8 does not have') + process.exit() +} + const { Response, Request, FormData, Headers } = require('../../undici-fetch') test('bundle sets constructor.name and .name properly', (t) => { From a0c8c1b32c7bf90351efc0045647751c424161e6 Mon Sep 17 00:00:00 2001 From: Khafra Date: Wed, 25 Oct 2023 14:31:05 -0400 Subject: [PATCH 2/3] skip more tests --- test/fetch/client-node-max-header-size.js | 8 +++++++- test/fetch/issue-1447.js | 8 +++++++- test/fetch/user-agent.js | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/test/fetch/client-node-max-header-size.js b/test/fetch/client-node-max-header-size.js index 432a576b97e..737bae8ed6e 100644 --- a/test/fetch/client-node-max-header-size.js +++ b/test/fetch/client-node-max-header-size.js @@ -1,7 +1,13 @@ 'use strict' const { execSync } = require('node:child_process') -const { test } = require('tap') +const { test, skip } = require('tap') +const { nodeMajor } = require('../../lib/core/util') + +if (nodeMajor === 16) { + skip('esbuild uses static blocks with --keep-names which node 16.8 does not have') + process.exit() +} const command = 'node -e "require(\'./undici-fetch.js\').fetch(\'https://httpbin.org/get\')"' diff --git a/test/fetch/issue-1447.js b/test/fetch/issue-1447.js index cfa5e94c0ed..503b34406d2 100644 --- a/test/fetch/issue-1447.js +++ b/test/fetch/issue-1447.js @@ -1,6 +1,12 @@ 'use strict' -const { test } = require('tap') +const { test, skip } = require('tap') +const { nodeMajor } = require('../../lib/core/util') + +if (nodeMajor === 16) { + skip('esbuild uses static blocks with --keep-names which node 16.8 does not have') + process.exit() +} const undici = require('../..') const { fetch: theoreticalGlobalFetch } = require('../../undici-fetch') diff --git a/test/fetch/user-agent.js b/test/fetch/user-agent.js index 48a69b4d7aa..8c6f486d4f2 100644 --- a/test/fetch/user-agent.js +++ b/test/fetch/user-agent.js @@ -1,10 +1,16 @@ 'use strict' -const { test } = require('tap') +const { test, skip } = require('tap') const events = require('events') const http = require('http') const undici = require('../../') const nodeBuild = require('../../undici-fetch.js') +const { nodeMajor } = require('../../lib/core/util') + +if (nodeMajor === 16) { + skip('esbuild uses static blocks with --keep-names which node 16.8 does not have') + process.exit() +} test('user-agent defaults correctly', async (t) => { const server = http.createServer((req, res) => { From 476ce9b2143ea614b94275e75417dfa8d8fae7ad Mon Sep 17 00:00:00 2001 From: Khafra Date: Wed, 25 Oct 2023 14:43:07 -0400 Subject: [PATCH 3/3] fix --- test/fetch/user-agent.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/fetch/user-agent.js b/test/fetch/user-agent.js index 8c6f486d4f2..2e37ea5883d 100644 --- a/test/fetch/user-agent.js +++ b/test/fetch/user-agent.js @@ -4,7 +4,6 @@ const { test, skip } = require('tap') const events = require('events') const http = require('http') const undici = require('../../') -const nodeBuild = require('../../undici-fetch.js') const { nodeMajor } = require('../../lib/core/util') if (nodeMajor === 16) { @@ -12,6 +11,8 @@ if (nodeMajor === 16) { process.exit() } +const nodeBuild = require('../../undici-fetch.js') + test('user-agent defaults correctly', async (t) => { const server = http.createServer((req, res) => { res.end(JSON.stringify({ userAgentHeader: req.headers['user-agent'] }))