diff --git a/packages/api/test/nfts-upload.spec.js b/packages/api/test/nfts-upload.spec.js index 5e20c4d252..3e8ce9cb8a 100644 --- a/packages/api/test/nfts-upload.spec.js +++ b/packages/api/test/nfts-upload.spec.js @@ -975,7 +975,13 @@ async function createListeningMockW3up() { const serverAddress = server.address() if (typeof serverAddress === 'string') throw new Error('server.address() must not return a string') - const url = new URL(`http://localhost:${serverAddress?.port ?? ''}`) + const urlString = `http://localhost:${serverAddress?.port ?? ''}` + let url + try { + url = new URL(urlString) + } catch (error) { + throw new Error(`unable to parse URL from "${urlString}"`, { cause: error }) + } return { get requestCount() { return requestCount