Skip to content

feat: add mock call history to access request configuration in test #15881

feat: add mock call history to access request configuration in test

feat: add mock call history to access request configuration in test #15881

Re-run triggered January 26, 2025 18:49
Status Failure
Total duration 3m 43s
Artifacts

nodejs.yml

on: pull_request
Matrix: test-without-intl
Matrix: test
dependency-review
8s
dependency-review
Lint
38s
Lint
Fuzzing
3m 30s
Fuzzing
Test TypeScript types
36s
Test TypeScript types
Test with SQLite enabled
26s
Test with SQLite enabled
automerge
0s
automerge
Fit to window
Zoom out
Zoom in

Annotations

120 errors, 11 warnings, and 21 notices
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) at node:internal/per_context/primordials:482:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:498:5) at Function.doesNotThrow (node:assert:664:32) at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: Error: kaboom at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/home/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /home/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/home/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' }] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:836:5) at Function.doesNotThrow (node:assert:1002:32) at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/home/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /home/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/home/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:805:5) at Function.doesNotThrow (node:assert:971:32) at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/home/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /home/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/home/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:836:5) at Function.doesNotThrow (node:assert:1002:32) at res.<computed> [as doesNotThrow] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/Users/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/Users/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/Users/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/Users/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/Users/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /Users/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) at node:internal/per_context/primordials:482:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:498:5) at Function.doesNotThrow (node:assert:664:32) at res.<computed> [as doesNotThrow] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: Error: kaboom at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/Users/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/Users/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/Users/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/Users/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/Users/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /Users/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' }] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:805:5) at Function.doesNotThrow (node:assert:971:32) at res.<computed> [as doesNotThrow] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/Users/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/Users/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/Users/runner/work/undici/undici/lib/api/api-request.js:188:10) at /Users/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/Users/runner/work/undici/undici/lib/api/api-request.js:178:12) at /Users/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/Users/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/Users/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/Users/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /Users/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/Users/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/Users/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /Users/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (/Users/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/Users/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
should handle a single interceptor: test\mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-pool.js:61:35 at getActual (node:assert:836:5) at Function.doesNotThrow (node:assert:1002:32) at res.<computed> [as doesNotThrow] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test\mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-pool.js:96:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test\mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test\mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test\mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test\mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at [dispatch] (D:\a\undici\undici\lib\dispatcher\agent.js:91:23) at Agent.dispatch (D:\a\undici\undici\lib\dispatcher\dispatcher-base.js:148:29) at MockAgent.dispatch (D:\a\undici\undici\lib\mock\mock-agent.js:61:25) at MockAgent.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 }
MockPool - allows matching headers in fetch: test\mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (D:\a\undici\undici\index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at [dispatch] (D:\a\undici\undici\lib\dispatcher\agent.js:91:23) at Agent.dispatch (D:\a\undici\undici\lib\dispatcher\dispatcher-base.js:148:29) at MockAgent.dispatch (D:\a\undici\undici\lib\mock\mock-agent.js:61:25) at D:\a\undici\undici\lib\web\fetch\index.js:2060:51 at new Promise (<anonymous>) at dispatch (D:\a\undici\undici\lib\web\fetch\index.js:2060:12) at httpNetworkFetch (D:\a\undici\undici\lib\web\fetch\index.js:1859:69) at httpNetworkOrCacheFetch (D:\a\undici\undici\lib\web\fetch\index.js:1561:35) } }
test\mock-pool.js: test\mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test\mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test\mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-interceptor.js:146:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
should handle a single interceptor: test\mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) at node:internal/per_context/primordials:482:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-pool.js:61:35 at getActual (node:assert:498:5) at Function.doesNotThrow (node:assert:664:32) at res.<computed> [as doesNotThrow] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test\mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-pool.js:96:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: Error: kaboom at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test\mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - should be able to use as a local dispatcher: test\mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - basic intercept with MockPool.request: test\mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) }
MockPool - correct errors when consuming invalid JSON body: test\mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at [dispatch] (D:\a\undici\undici\lib\dispatcher\agent.js:91:23) at Agent.dispatch (D:\a\undici\undici\lib\dispatcher\dispatcher-base.js:148:29) at MockAgent.dispatch (D:\a\undici\undici\lib\mock\mock-agent.js:61:25) at MockAgent.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 }
MockPool - allows matching headers in fetch: test\mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (D:\a\undici\undici\index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at [dispatch] (D:\a\undici\undici\lib\dispatcher\agent.js:91:23) at Agent.dispatch (D:\a\undici\undici\lib\dispatcher\dispatcher-base.js:148:29) at MockAgent.dispatch (D:\a\undici\undici\lib\mock\mock-agent.js:61:25) at D:\a\undici\undici\lib\web\fetch\index.js:2060:51 at new Promise (<anonymous>) at dispatch (D:\a\undici\undici\lib\web\fetch\index.js:2060:12) at httpNetworkFetch (D:\a\undici\undici\lib\web\fetch\index.js:1859:69) at httpNetworkOrCacheFetch (D:\a\undici\undici\lib\web\fetch\index.js:1561:35) } }
test\mock-pool.js: test\mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test\mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) }
should error if passed options invalid: test\mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' }] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-interceptor.js:146:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:805:5) at Function.doesNotThrow (node:assert:971:32) at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/home/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /home/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/home/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) at node:internal/per_context/primordials:482:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:498:5) at Function.doesNotThrow (node:assert:664:32) at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: Error: kaboom at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/home/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:797:9) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /home/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/home/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Test.start (node:internal/test_runner/test:703:17) at node:internal/test_runner/test:1133:71 at node:internal/per_context/primordials:482:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:450:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' }] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:498:5) at Function.throws (node:assert:644:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:206:9) at Test.run (node:internal/test_runner/test:796:25) at Suite.processPendingSubtests (node:internal/test_runner/test:527:18) at Test.postRun (node:internal/test_runner/test:889:19) at Test.run (node:internal/test_runner/test:835:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1135:7) at async Test.processPendingSubtests (node:internal/test_runner/test:527:7), operator: 'throws' } }
should handle a single interceptor: test\mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-pool.js:61:35 at getActual (node:assert:805:5) at Function.doesNotThrow (node:assert:971:32) at res.<computed> [as doesNotThrow] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test\mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-pool.js:96:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test\mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test\mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test\mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test\mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at [dispatch] (D:\a\undici\undici\lib\dispatcher\agent.js:91:23) at Agent.dispatch (D:\a\undici\undici\lib\dispatcher\dispatcher-base.js:148:29) at MockAgent.dispatch (D:\a\undici\undici\lib\mock\mock-agent.js:61:25) at MockAgent.request (D:\a\undici\undici\lib\api\api-request.js:188:10) at D:\a\undici\undici\lib\api\api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (D:\a\undici\undici\lib\api\api-request.js:178:12) at D:\a\undici\undici\index.js:102:15 }
MockPool - allows matching headers in fetch: test\mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (D:\a\undici\undici\index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (D:\a\undici\undici\test\mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at [dispatch] (D:\a\undici\undici\lib\dispatcher\agent.js:91:23) at Agent.dispatch (D:\a\undici\undici\lib\dispatcher\dispatcher-base.js:148:29) at MockAgent.dispatch (D:\a\undici\undici\lib\mock\mock-agent.js:61:25) at D:\a\undici\undici\lib\web\fetch\index.js:2060:51 at new Promise (<anonymous>) at dispatch (D:\a\undici\undici\lib\web\fetch\index.js:2060:12) at httpNetworkFetch (D:\a\undici\undici\lib\web\fetch\index.js:1859:69) at httpNetworkOrCacheFetch (D:\a\undici\undici\lib\web\fetch\index.js:1561:35) } }
test\mock-pool.js: test\mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test\mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test\mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (D:\a\undici\undici\lib\mock\mock-utils.js:264:34) at MockPool.dispatch (D:\a\undici\undici\lib\mock\mock-utils.js:339:22) at D:\a\undici\undici\test\mock-interceptor.js:146:29 at getActual (node:assert:805:5) at Function.throws (node:assert:951:24) at res.<computed> [as throws] (D:\a\undici\undici\node_modules\@matteo.collina\tspl\tspl.js:52:35) at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (D:\a\undici\undici\test\mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
should handle a single interceptor: test/mock-pool.js#L61
Error [ERR_TEST_FAILURE]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Got unwanted exception. Actual message: "Cannot read properties of undefined (reading '_add')" at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) at node:internal/per_context/primordials:483:9 { generatedMessage: false, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:61:35 at getActual (node:assert:836:5) at Function.doesNotThrow (node:assert:1002:32) at res.<computed> [as doesNotThrow] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:61:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17), expected: undefined, operator: 'doesNotThrow' } }
should directly throw error from mockDispatch function if error is not a MockNotMatchedError: test/mock-pool.js#L96
Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at async Promise.all (index 0) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'kaboom', - name: 'Error' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-pool.js:96:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:96:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: Error: kaboom at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:103:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
MockPool - should be able to set as globalDispatcher: test/mock-pool.js#L211
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:211:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - should be able to use as a local dispatcher: test/mock-pool.js#L246
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:246:38) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) }
MockPool - basic intercept with MockPool.request: test/mock-pool.js#L285
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockPool.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:285:66) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) }
MockPool - correct errors when consuming invalid JSON body: test/mock-pool.js#L302
[Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add')] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:188:10) at /home/runner/work/undici/undici/lib/api/api-request.js:179:15 at new Promise (<anonymous>) at MockAgent.request (/home/runner/work/undici/undici/lib/api/api-request.js:178:12) at /home/runner/work/undici/undici/index.js:102:15 }
MockPool - allows matching headers in fetch: test/mock-pool.js#L348
[Error [ERR_TEST_FAILURE]: fetch failed] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: fetch failed at fetch (/home/runner/work/undici/undici/index.js:120:13) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-pool.js:348:3) at async Test.run (node:internal/test_runner/test:932:9) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { [cause]: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at [dispatch] (/home/runner/work/undici/undici/lib/dispatcher/agent.js:91:23) at Agent.dispatch (/home/runner/work/undici/undici/lib/dispatcher/dispatcher-base.js:148:29) at MockAgent.dispatch (/home/runner/work/undici/undici/lib/mock/mock-agent.js:61:25) at /home/runner/work/undici/undici/lib/web/fetch/index.js:2060:51 at new Promise (<anonymous>) at dispatch (/home/runner/work/undici/undici/lib/web/fetch/index.js:2060:12) at httpNetworkFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1859:69) at httpNetworkOrCacheFetch (/home/runner/work/undici/undici/lib/web/fetch/index.js:1561:35) } }
test/mock-pool.js: test/mock-pool.js#L1
[Error [ERR_TEST_FAILURE]: test timed out after 30000ms] { code: 'ERR_TEST_FAILURE', failureType: 'testTimeoutFailure', cause: 'test timed out after 30000ms' }
should return MockScope: test/mock-interceptor.js#L99
Error [ERR_TEST_FAILURE]: Cannot read properties of undefined (reading '_add') at new Promise (<anonymous>) at Array.map (<anonymous>) { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: TypeError [Error]: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:99:14) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Test.start (node:internal/test_runner/test:829:17) at node:internal/test_runner/test:1308:71 at node:internal/per_context/primordials:483:82 at new Promise (<anonymous>) at new SafePromise (node:internal/per_context/primordials:451:29) }
should error if passed options invalid: test/mock-interceptor.js#L146
[Error [ERR_TEST_FAILURE]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } ] { code: 'ERR_TEST_FAILURE', failureType: 'testCodeFailure', cause: AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - code: 'UND_ERR_INVALID_ARG', - message: 'reply options callback must return an object', - name: 'InvalidArgumentError' } at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7) { generatedMessage: true, code: 'ERR_ASSERTION', actual: TypeError: Cannot read properties of undefined (reading '_add') at MockPool.mockDispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:264:34) at MockPool.dispatch (/home/runner/work/undici/undici/lib/mock/mock-utils.js:339:22) at /home/runner/work/undici/undici/test/mock-interceptor.js:146:29 at getActual (node:assert:836:5) at Function.throws (node:assert:982:24) at res.<computed> [as throws] (/home/runner/work/undici/undici/node_modules/@matteo.collina/tspl/tspl.js:52:35) at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:146:7) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18), expected: InvalidArgumentError: reply options callback must return an object at TestContext.<anonymous> (/home/runner/work/undici/undici/test/mock-interceptor.js:153:9) at Test.runInAsyncScope (node:async_hooks:211:14) at Test.run (node:internal/test_runner/test:931:25) at Suite.processPendingSubtests (node:internal/test_runner/test:629:18) at Test.postRun (node:internal/test_runner/test:1042:19) at Test.run (node:internal/test_runner/test:970:12) at async Promise.all (index 0) at async Suite.run (node:internal/test_runner/test:1310:7) at async Test.processPendingSubtests (node:internal/test_runner/test:629:7), operator: 'throws' } }
dependency-review
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Test with SQLite enabled
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Test TypeScript types
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Lint
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
test (20, ubuntu-latest) / Test with Node.js 20 on ubuntu-latest
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
test (23, ubuntu-latest) / Test with Node.js 23 on ubuntu-latest
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
test (22, ubuntu-latest) / Test with Node.js 22 on ubuntu-latest
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Test with Node.js 22 compiled --without-intl
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Test with Node.js 20 compiled --without-intl
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Test with Node.js 23 compiled --without-intl
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Fuzzing
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
Test with SQLite enabled
Total Tests: 33 Suites 📂: 5 Passed ✅: 33 Failed ❌: 0 Canceled 🚫: 0 Skipped ⏭️: 0 Todo 📝: 0 Duration 🕐: 151.815ms
test (20, ubuntu-latest) / Test with Node.js 20 on ubuntu-latest
Error:: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' }" and would have caused the test to fail, but instead triggered an unhandledRejection event. Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 58451.842ms
test (23, ubuntu-latest) / Test with Node.js 23 on ubuntu-latest: test/issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
test (23, ubuntu-latest) / Test with Node.js 23 on ubuntu-latest
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 58099.684ms
test (22, ubuntu-latest) / Test with Node.js 22 on ubuntu-latest: test/issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
test (22, ubuntu-latest) / Test with Node.js 22 on ubuntu-latest
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 59943.709ms
test (23, macos-latest) / Test with Node.js 23 on macos-latest: test/issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
test (23, macos-latest) / Test with Node.js 23 on macos-latest
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 79886.747ms
test (20, macos-latest) / Test with Node.js 20 on macos-latest
Error:: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' }" and would have caused the test to fail, but instead triggered an unhandledRejection event. Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 80457.635ms
test (22, macos-latest) / Test with Node.js 22 on macos-latest: test/issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
test (22, macos-latest) / Test with Node.js 22 on macos-latest
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 81051.805ms
test (23, windows-latest) / Test with Node.js 23 on windows-latest: test\issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test\issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
test (23, windows-latest) / Test with Node.js 23 on windows-latest
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 63935.192ms
test (20, windows-latest) / Test with Node.js 20 on windows-latest
Error:: Test "stream() does not fail after request has been aborted" at test\issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' }" and would have caused the test to fail, but instead triggered an unhandledRejection event. Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 61996.893ms
Test with Node.js 22 compiled --without-intl: test/issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
Test with Node.js 22 compiled --without-intl
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 57325.789ms
Test with Node.js 20 compiled --without-intl
Error:: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' }" and would have caused the test to fail, but instead triggered an unhandledRejection event. Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 58249.205ms
test (22, windows-latest) / Test with Node.js 22 on windows-latest: test\issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test\issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
test (22, windows-latest) / Test with Node.js 22 on windows-latest
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 65762.884ms
Test with Node.js 23 compiled --without-intl: test/issue-2349.js#L1
Error: Test "stream() does not fail after request has been aborted" at test/issue-2349.js:8:1 generated asynchronous activity after the test ended. This activity created the error "AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal: + actual - expected Comparison { + message: "Cannot read properties of undefined (reading '_add')", + name: 'TypeError' - message: 'This operation was aborted', - name: 'AbortError' } " and would have caused the test to fail, but instead triggered an unhandledRejection event.
Test with Node.js 23 compiled --without-intl
Total Tests: 1022 Suites 📂: 92 Passed ✅: 882 Failed ❌: 132 Canceled 🚫: 3 Skipped ⏭️: 5 Todo 📝: 0 Duration 🕐: 57266.786ms