Skip to content

Commit

Permalink
fix names with esbuild (#2359)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Oct 19, 2023
1 parent daf349f commit 0681760
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"docs"
],
"scripts": {
"build:node": "npx esbuild@0.19.4 index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1",
"build:node": "npx esbuild@0.19.4 index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names",
"prebuild:wasm": "node build/wasm.js --prebuild",
"build:wasm": "node build/wasm.js --docker",
"lint": "standard | snazzy",
Expand Down
20 changes: 20 additions & 0 deletions test/fetch/bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'

const { test } = require('tap')
const { Response, Request, FormData, Headers } = require('../../undici-fetch')

test('bundle sets constructor.name and .name properly', (t) => {
t.equal(new Response().constructor.name, 'Response')
t.equal(Response.name, 'Response')

t.equal(new Request('http://a').constructor.name, 'Request')
t.equal(Request.name, 'Request')

t.equal(new Headers().constructor.name, 'Headers')
t.equal(Headers.name, 'Headers')

t.equal(new FormData().constructor.name, 'FormData')
t.equal(FormData.name, 'FormData')

t.end()
})

0 comments on commit 0681760

Please sign in to comment.