From d83687852dfd58490bbd4043be0b3768c817c28f Mon Sep 17 00:00:00 2001 From: Khafra Date: Thu, 13 Apr 2023 03:38:51 -0400 Subject: [PATCH] fix: rename .wasm to -wasm to appease jest (#2064) * fix: rename .wasm to -wasm to appease jest * fix: use local server for redirect node-fetch test --- build/wasm.js | 4 ++-- lib/client.js | 6 +++--- lib/llhttp/{llhttp.wasm.js => llhttp-wasm.js} | 0 lib/llhttp/{llhttp_simd.wasm.js => llhttp_simd-wasm.js} | 0 test/node-fetch/main.js | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) rename lib/llhttp/{llhttp.wasm.js => llhttp-wasm.js} (100%) rename lib/llhttp/{llhttp_simd.wasm.js => llhttp_simd-wasm.js} (100%) diff --git a/build/wasm.js b/build/wasm.js index 98de2b38c5d..48ec53cb0b4 100644 --- a/build/wasm.js +++ b/build/wasm.js @@ -46,7 +46,7 @@ execSync(`${WASI_ROOT}/bin/clang \ const base64Wasm = readFileSync(join(WASM_OUT, 'llhttp.wasm')).toString('base64') writeFileSync( - join(WASM_OUT, 'llhttp.wasm.js'), + join(WASM_OUT, 'llhttp-wasm.js'), `module.exports = "${base64Wasm}";\n` ) @@ -74,6 +74,6 @@ execSync(`${WASI_ROOT}/bin/clang \ const base64WasmSimd = readFileSync(join(WASM_OUT, 'llhttp_simd.wasm')).toString('base64') writeFileSync( - join(WASM_OUT, 'llhttp_simd.wasm.js'), + join(WASM_OUT, 'llhttp_simd-wasm.js'), `module.exports = "${base64WasmSimd}";\n` ) diff --git a/lib/client.js b/lib/client.js index b230c368dab..269d6e1a607 100644 --- a/lib/client.js +++ b/lib/client.js @@ -359,11 +359,11 @@ const createRedirectInterceptor = require('./interceptor/redirectInterceptor') const EMPTY_BUF = Buffer.alloc(0) async function lazyllhttp () { - const llhttpWasmData = process.env.JEST_WORKER_ID ? require('./llhttp/llhttp.wasm.js') : undefined + const llhttpWasmData = process.env.JEST_WORKER_ID ? require('./llhttp/llhttp-wasm.js') : undefined let mod try { - mod = await WebAssembly.compile(Buffer.from(require('./llhttp/llhttp_simd.wasm.js'), 'base64')) + mod = await WebAssembly.compile(Buffer.from(require('./llhttp/llhttp_simd-wasm.js'), 'base64')) } catch (e) { /* istanbul ignore next */ @@ -371,7 +371,7 @@ async function lazyllhttp () { // being enabled, but the occurring of this other error // * https://github.com/emscripten-core/emscripten/issues/11495 // got me to remove that check to avoid breaking Node 12. - mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || require('./llhttp/llhttp.wasm.js'), 'base64')) + mod = await WebAssembly.compile(Buffer.from(llhttpWasmData || require('./llhttp/llhttp-wasm.js'), 'base64')) } return await WebAssembly.instantiate(mod, { diff --git a/lib/llhttp/llhttp.wasm.js b/lib/llhttp/llhttp-wasm.js similarity index 100% rename from lib/llhttp/llhttp.wasm.js rename to lib/llhttp/llhttp-wasm.js diff --git a/lib/llhttp/llhttp_simd.wasm.js b/lib/llhttp/llhttp_simd-wasm.js similarity index 100% rename from lib/llhttp/llhttp_simd.wasm.js rename to lib/llhttp/llhttp_simd-wasm.js diff --git a/test/node-fetch/main.js b/test/node-fetch/main.js index ab3ee9f70ae..8dc20f2ce64 100644 --- a/test/node-fetch/main.js +++ b/test/node-fetch/main.js @@ -1648,7 +1648,7 @@ describe('node-fetch', () => { it('should allow manual redirect handling', function () { this.timeout(5000) - const url = 'https://httpbin.org/status/302' + const url = `${base}redirect/302` const options = { redirect: 'manual' } @@ -1656,7 +1656,7 @@ describe('node-fetch', () => { expect(res.status).to.equal(302) expect(res.url).to.equal(url) expect(res.type).to.equal('basic') - expect(res.headers.get('Location')).to.equal('/redirect/1') + expect(res.headers.get('Location')).to.equal('/inspect') expect(res.ok).to.be.false }) })