CycloneDX / cdxgen

Creates CycloneDX Bill of Materials (BOM) for your projects from source and container images. Supports many languages and package managers. Integrate in your CI/CD pipeline with automatic submission to Dependency Track server.
https://cyclonedx.github.io/cdxgen/
Apache License 2.0
553 stars 158 forks source link

[bun] got related tests are not working #835

Open prabhu opened 7 months ago

prabhu commented 7 months ago

Tests that involve HTTP calls with got are broken with bun. It's best to wait till it improves since rewriting cdxgen without got is not risk-free.

✓ parse cargo auditable data [0.36ms]
89 |                 Object.assign(this.options.headers, source.headers);
90 |             }
91 |         });
92 |         this.on('newListener', event => {
93 |             if (event === 'retry' && this.listenerCount('retry') > 0) {
94 |                 throw new Error('A retry listener has been attached already.');
                           ^
error: A retry listener has been attached already.
      at /mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/core/index.js:94:23
      at makeRequest (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/as-promise/index.js:107:13)
      at /mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/as-promise/index.js:125:9
      at /mnt/work/CycloneDX/cdxgen/node_modules/.deno/p-cancelable@4.0.1/node_modules/p-cancelable/index.js:68:4
      at new Promise (:1:21)
      at new PCancelable (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/p-cancelable@4.0.1/node_modules/p-cancelable/index.js:34:19)
      at asPromise (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/as-promise/index.js:21:21)
      at lastHandler (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/create.js:42:27)
      at iterateHandlers (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/create.js:49:19)
✓ parse .net cs proj [4.34ms]
89 |                 Object.assign(this.options.headers, source.headers);
90 |             }
91 |         });
92 |         this.on('newListener', event => {
93 |             if (event === 'retry' && this.listenerCount('retry') > 0) {
94 |                 throw new Error('A retry listener has been attached already.');
                           ^
error: A retry listener has been attached already.
      at /mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/core/index.js:94:23
      at makeRequest (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/as-promise/index.js:107:13)
      at /mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/as-promise/index.js:125:9
      at /mnt/work/CycloneDX/cdxgen/node_modules/.deno/p-cancelable@4.0.1/node_modules/p-cancelable/index.js:68:4
      at new Promise (:1:21)
      at new PCancelable (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/p-cancelable@4.0.1/node_modules/p-cancelable/index.js:34:19)
      at asPromise (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/as-promise/index.js:21:21)
      at lastHandler (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/create.js:42:27)
      at iterateHandlers (/mnt/work/CycloneDX/cdxgen/node_modules/.deno/got@14.0.0/node_modules/got/dist/source/create.js:49:19)
✗ get nget metadata [1.43ms]
prabhu commented 7 months ago

Related: https://github.com/oven-sh/bun/pull/4395 https://github.com/oven-sh/bun/pull/8368 https://github.com/sindresorhus/got/issues/2299

prabhu commented 5 months ago

Looks like these bugs are still unresolved.

https://github.com/CycloneDX/cdxgen/actions/runs/8788201035/job/24115125965#step:75:74

prabhu commented 3 months ago

Latest error with got 14.3.0

767 |             const cacheRequest = cacheableStore.get(options.cache)(options, async (response) => {
768 |                 response._readableState.autoDestroy = false;
769 |                 if (request) {
770 |                     const fix = () => {
771 |                         if (response.req) {
772 |                             response.complete = response.req.res.complete;
                                                      ^
TypeError: undefined is not an object (evaluating 'response.req.res.complete')
      at fix (/home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:772:49)
      at /home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:776:21
      at /home/runner/work/cdxgen/cdxgen/node_modules/got/dist/source/core/index.js:767:84
      at /home/runner/work/cdxgen/cdxgen/node_modules/cacheable-request/dist/index.js:148:25
      at handler (/home/runner/work/cdxgen/cdxgen/node_modules/cacheable-request/dist/index.js:77:40)
      at node:http:930:191