[Bug]: code that demonstrably throws fails .toThrow check

Version

29.7.0

Steps to reproduce

clone https://github.com/Pomax/socketless, check out the jest-throw-error branch, run npm i, then run npm test -- -- ./test/base.test.js

The test code has this:

      async onConnect() {
        // try to call protected server functions
        try {
          await this.server.teardown();
        } catch (e) {
          console.log(`definitely throws`);
          expect(e).toBeDefined();
        }

        expect(async () => {
          console.log(`this, Jest claims, does not`);
          await this.server.teardown();
        }).toThrow();

        this.disconnect();
      }

Expected behavior

Either those both succeed, or they both fail, because either that call throws, or it doesn't.

Actual behavior

The first test passes. A throw occurred. The second test fails. Even though the throw obvious still occurred

  console.log
    definitely throws

      at ClientBase.log [as onConnect] (test/base.test.js:36:19)

  console.log
    this, Jest claims, does not

      at log (test/base.test.js:41:19)

 FAIL  test/base.test.js (5.321 s)
  web client tests
    √ can run a basic client/server setup (22 ms)
    × disallows calling protected functions (5001 ms)

Additional context

When using Jest, I get the error show as tracing back to completely the wrong place, pointing at the location where a new Error() object gets created, instead of where it's actually thrown:

      at ClientBase.toThrow [as onConnect] (test/base.test.js:43:12)

  ● web client tests › disallows calling protected functions

    Illegal call: teardown is a protected method

      89 |     } = data;
      90 |
    > 91 |     let throwable = errorMsg ? new Error(errorMsg) : undefined;
         |                                ^
      92 |
      93 |     if (DEBUG)
      94 |       console.log(`debugdebug`, originName, eventName, payload, errorMsg);

      at UpgradedSocket.router (src/upgraded-socket.js:91:32)
      at Receiver.receiverOnMessage (node_modules/ws/lib/websocket.js:1192:20)
      at Receiver.dataMessage (node_modules/ws/lib/receiver.js:560:14)
      at Receiver.getData (node_modules/ws/lib/receiver.js:478:17)
      at Receiver.startLoop (node_modules/ws/lib/receiver.js:167:22)
      at Receiver._write (node_modules/ws/lib/receiver.js:93:10)
      at Socket.socketOnData (node_modules/ws/lib/websocket.js:1286:35)

Environment

I'm not installing `envinfo` because I have no reason to trust that tool. Instead:

Node v19.8.1 with NPM 9.5.1
Windows 10 x64 Pro