Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename .wasm to -wasm to appease jest #2064

Merged
merged 2 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
)

Expand Down Expand Up @@ -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`
)
6 changes: 3 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,19 +359,19 @@ 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 */

// We could check if the error was caused by the simd option not
// 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, {
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions test/node-fetch/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1648,15 +1648,15 @@ 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'
}
return fetch(url, options).then(res => {
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
})
})
Expand Down