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

Jest workers cannot handle circular structures #41

Open
szmarczak opened this issue Aug 16, 2021 · 0 comments
Open

Jest workers cannot handle circular structures #41

szmarczak opened this issue Aug 16, 2021 · 0 comments

Comments

@szmarczak
Copy link
Contributor

szmarczak commented Aug 16, 2021

https://github.com/apify/got-scraping/compare/ts...e559bc263272236c2bce32d6515cfc47cb40788b#files_bucket (GitHub plz fix links)

szm@solus ~/Desktop/got-scraping $ npm test

> [email protected] test
> jest --maxWorkers=3 --collect-coverage

 PASS  test/options-validator.test.ts
  Options validation
    ✓ should validate proxyUrl (7 ms)
    ✓ should validate useHeaderGenerator (1 ms)
    ✓ should validate headerGeneratorOptions (1 ms)

 PASS  test/proxy.test.ts
  Proxy
    ✓ should not add an agent if proxyUrl is not provided (2 ms)
    ✓ should add an agent if proxyUrl is provided (3 ms)
    ✓ should throw on invalid proxy protocol (14 ms)
    agents
      ✓ should support http request over http proxy (1 ms)
      ✓ should support https request over http proxy
      ✓ should support http2 request over http proxy (1 ms)
      ✓ should support http request over https proxy (1 ms)
      ✓ should support https request over https proxy (1 ms)
      ✓ should support http2 request over https proxy
      ✓ should support http request over http2 proxy (1 ms)
      ✓ should support https request over http2 proxy (1 ms)
      ✓ should support http2 request over http2 proxy

 PASS  test/agent.test.ts
  TransformHeadersAgent
    ✓ Pascal-Case (2 ms)
    ✓ transformRequest (19 ms)
    ✓ leaves x-header as it is (4 ms)
    ✓ http.request with agent (3 ms)
    ✓ first header in sortedHeaders is always first (2 ms)
    respects native behavior
      ✓ content-length removal (2 ms)
      ✓ transfer-encoding removal (3 ms)
      ✓ explicit content-length (2 ms)
      ✓ explicit connection (2 ms)

 PASS  test/custom-options.test.ts
  Custom options
    ✓ should move custom options to context (10 ms)

 PASS  test/scraping-defaults.test.ts
  Scraping defaults
    ✓ should set correct defaults (26 ms)
    ✓ should allow user to override the defaults (5 ms)
    ✓ should have compatible defaults with node 10 (1 ms)

 PASS  test/browser-headers.test.ts
  Browser headers
    ✓ should not generate headers without useHeaderGenerator (1 ms)
    ✓ should generate headers with useHeaderGenerator (1 ms)
    ✓ should add headers when http2 is used
    ✓ should add headers when http1 is used (1 ms)
    ✓ should pass option to header generator
    ✓ should override default ua header (1 ms)
    ✓ should have working generator (7 ms)
    ✓ should have capitalized headers with http1 (3 ms)
    ✓ should respect casing of unrecognized headers (3 ms)
    mergeHeaders
      ✓ should merge headers
      ✓ should allow deleting header
      ✓ should allow adding header (1 ms)

node:internal/child_process/serialization:127
    const string = JSONStringify(message) + '\n';
                   ^

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property '_httpMessage' -> object with constructor 'Object'
    --- property 'socket' closes the circle
    at stringify (<anonymous>)
    at writeChannelMessage (node:internal/child_process/serialization:127:20)
    at process.target._send (node:internal/child_process:822:17)
    at process.target.send (node:internal/child_process:722:19)
    at reportSuccess (/home/szm/Desktop/got-scraping/node_modules/jest-worker/build/workers/processChild.js:67:11)
node:internal/child_process/serialization:127
    const string = JSONStringify(message) + '\n';
                   ^

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property '_httpMessage' -> object with constructor 'Object'
    --- property 'socket' closes the circle
    at stringify (<anonymous>)
    at writeChannelMessage (node:internal/child_process/serialization:127:20)
    at process.target._send (node:internal/child_process:822:17)
    at process.target.send (node:internal/child_process:722:19)
    at reportSuccess (/home/szm/Desktop/got-scraping/node_modules/jest-worker/build/workers/processChild.js:67:11)
node:internal/child_process/serialization:127
    const string = JSONStringify(message) + '\n';
                   ^

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property '_httpMessage' -> object with constructor 'Object'
    --- property 'socket' closes the circle
    at stringify (<anonymous>)
    at writeChannelMessage (node:internal/child_process/serialization:127:20)
    at process.target._send (node:internal/child_process:822:17)
    at process.target.send (node:internal/child_process:722:19)
    at reportSuccess (/home/szm/Desktop/got-scraping/node_modules/jest-worker/build/workers/processChild.js:67:11)
node:internal/child_process/serialization:127
    const string = JSONStringify(message) + '\n';
                   ^

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'Object'
    |     property '_httpMessage' -> object with constructor 'Object'
    --- property 'socket' closes the circle
    at stringify (<anonymous>)
    at writeChannelMessage (node:internal/child_process/serialization:127:20)
    at process.target._send (node:internal/child_process:822:17)
    at process.target.send (node:internal/child_process:722:19)
    at reportSuccess (/home/szm/Desktop/got-scraping/node_modules/jest-worker/build/workers/processChild.js:67:11)
 FAIL  test/main.test.ts
  ● Test suite failed to run

    Jest worker encountered 4 child process exceptions, exceeding retry limit

      at ChildProcessWorker.initialize (node_modules/jest-worker/build/workers/ChildProcessWorker.js:193:21)
@szmarczak szmarczak changed the title Jest cannot handle circular structures Jest workers cannot handle circular structures Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant